Documentation
¶
Index ¶
Constants ¶
View Source
const ( CredentialTypeBasic = CredentialType("BASIC") CredentialTypeAPIKey = CredentialType("BEARER") )
View Source
const ( RoleSuperUser = RoleType("super_user") RoleUIAdmin = RoleType("ui_admin") RoleAdmin = RoleType("admin") RoleAPI = RoleType("api") )
Variables ¶
View Source
var (
ErrCredentialNotFound = errors.New("credential not found")
)
Functions ¶
This section is empty.
Types ¶
type AuthenticatedUser ¶
type AuthenticatedUser struct {
AuthenticatedByRealm string `json:"-"` // Name of realm that authenticated this user
Credential Credential `json:"credential"`
Role Role `json:"role"`
}
type Credential ¶
type Credential struct {
Type CredentialType `json:"type"`
Username string `json:"username"`
Password string `json:"password"`
APIKey string `json:"api_key"`
}
func (*Credential) String ¶
func (c *Credential) String() string
type CredentialType ¶
type CredentialType string
func (CredentialType) String ¶
func (c CredentialType) String() string
type Realm ¶
type Realm interface {
GetName() string
Authenticate(ctx context.Context, cred *Credential) (*AuthenticatedUser, error)
}
Click to show internal directories.
Click to hide internal directories.