Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Account ¶
type Account interface {
Get(AccountConstant) interface{}
List() []AccountConstant
Anonymous() bool
Redirect(c *gin.Context)
}
Account is an interface that gives the application access to infos about the user.
type AccountConstant ¶
type AccountConstant string
AccountConstant is an type for easier linting.
const ( // AccountID is the ID of the session. Prefferably it should be an UUIDv4 to mitigate security errors. AccountID AccountConstant = "jti" // AccountAnon is to identify Sessions as Anonymous sessions. AccountAnon AccountConstant = "anon" // AccountUser is an attribute that identifies the user with an string that is unique for the user, for Example the username. AccountUser AccountConstant = "uid" )
These are Constants to save specific attributes in single points of use.
type AnonAccount ¶
type AnonAccount struct{}
AnonAccount is an simple Account-interface implementation. It is always Anonymous
func (*AnonAccount) Get ¶
func (*AnonAccount) Get(key AccountConstant) (in interface{})
Get returns only AccountAnon = true
func (*AnonAccount) List ¶
func (*AnonAccount) List() []AccountConstant
List return only AccountAnon as the only Listitem
func (*AnonAccount) Redirect ¶
func (*AnonAccount) Redirect(c *gin.Context)
Redirect should point to an login, but since its not possible for this handler it sends an 401 Page
type AnonAccountHandler ¶
type AnonAccountHandler struct{}
AnonAccountHandler is an simple struct that fullfills the AuthenticationHandler Interface
type AuthenticationHandler ¶
AuthenticationHandler is an interface that is used to give the account of the request. it is set into the context using gin.Context.Set. The context must be reused for the redirect. Account NEVER returns nil. Not loggedin Users have return Anonymous() = true and get() = nil and List() = []string{}