Documentation ¶
Index ¶
- Constants
- func AddAuthAPIsToHandler(handler core.Handler, db core.DB)
- func DeleteTokenCookie(c *core.APICallContext)
- func ValidateToken(provider *oidc.Provider, config *oauth2.Config, token *Token) (*oidc.IDToken, error)
- func WriteTokenToCookie(c *core.APICallContext, config *oauth2.Config, provider *oidc.Provider, ...)
- type AccID
- type Account
- type AuthKeyCloakAPI
- type IDTokenClaim
- type MongoAccountService
- type State
- type StateMap
- type Token
- type Type
Constants ¶
const ( // EMAIL key EMAIL = "name" // ID key ID = "id" )
Variables ¶
This section is empty.
Functions ¶
func AddAuthAPIsToHandler ¶
AddAuthAPIsToHandler constructs an API for recipes
func DeleteTokenCookie ¶
func DeleteTokenCookie(c *core.APICallContext)
DeleteTokenCookie by setting the cookie maxAge to -1
func ValidateToken ¶
func ValidateToken(provider *oidc.Provider, config *oauth2.Config, token *Token) (*oidc.IDToken, error)
ValidateToken ensures the validity of the token
func WriteTokenToCookie ¶
func WriteTokenToCookie(c *core.APICallContext, config *oauth2.Config, provider *oidc.Provider, token *Token)
WriteTokenToCookie stores the token in a cookie
Types ¶
type Account ¶
Account document that can be stored in the database
func NewAccount ¶
NewAccount is created with a specific name (eMail ID) and type (e.g., KEYCLOAK)
type AuthKeyCloakAPI ¶
type AuthKeyCloakAPI struct {
// contains filtered or unexported fields
}
AuthKeyCloakAPI for authorization
type IDTokenClaim ¶
type IDTokenClaim struct {
Email string `json:"email"`
}
IDTokenClaim represents the relevant claims
type MongoAccountService ¶
type MongoAccountService struct {
DbClient *core.MongoClient
}
MongoAccountService stores and manipulates stored accounts in a DB
func NewMongoAccountService ¶
func NewMongoAccountService(db core.DB) *MongoAccountService
NewMongoAccountService is created and configured
func (*MongoAccountService) DeleteAccountByID ¶
func (db *MongoAccountService) DeleteAccountByID(id AccID) error
DeleteAccountByID deletes an account indefinitely
func (*MongoAccountService) DeleteAccountByName ¶
func (db *MongoAccountService) DeleteAccountByName(name string) error
DeleteAccountByName deletes an account indefinitely
func (*MongoAccountService) FindAccount ¶
func (db *MongoAccountService) FindAccount(name string) (*Account, error)
FindAccount by Name
func (*MongoAccountService) NewAccount ¶
func (db *MongoAccountService) NewAccount(name string, t Type) (*Account, error)
NewAccount stores the account information in a db
type StateMap ¶
StateMap type to cache all states
var States StateMap
States cached for reuse
func (StateMap) CreateState ¶
CreateState to reuse later
func (StateMap) FindAndDelete ¶
FindAndDelete returns the state for a given key and deletes the entry of the StateMap