Documentation ¶
Index ¶
Constants ¶
const OsiamProviderName = "osiam"
OsiamProviderName const with the name of the provider
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Backend ¶
type Backend struct {
// contains filtered or unexported fields
}
Backend is the osiam authentication backend.
func NewBackend ¶
NewBackend creates a new OSIAM Backend and verifies the parameters.
type Client ¶
Client is a wrapper for the osiam API.
func (*Client) GetTokenByPassword ¶
func (c *Client) GetTokenByPassword(username, password string, scopes ...string) (authenticated bool, token *Token, err error)
GetTokenByPassword does an Osiam authorisation by Resource Owner Password Credentials Grant. If no scopes are supplied, the default scope is 'me'.
type OsiamError ¶
OsiamError represents an error response from osiam.
func ParseOsiamError ¶
func ParseOsiamError(jsonBody []byte) OsiamError
ParseOsiamError creates an OsiamError out of a json
func (OsiamError) IsLoginError ¶
func (e OsiamError) IsLoginError() bool
IsLoginError checks, if the grant was invalid
func (OsiamError) IsUnauthorized ¶
func (e OsiamError) IsUnauthorized() bool
IsUnauthorized checks, if the error reason was Unauthorized
type Timestamp ¶
Timestamp is a helper class for json handling ht the timestamp
func (*Timestamp) MarshalJSON ¶
MarshalJSON does the marshaling
func (*Timestamp) UnmarshalJSON ¶
UnmarshalJSON does the unmarshaling
type Token ¶
type Token struct { TokenType string `json:"token_type"` // example "bearer" AccessToken string `json:"access_token"` // example "79f479c2-c0d7-458a-8464-7eb887dbc943" RefreshToken string `json:"refresh_token"` // example "3c7c4a87-dc91-4dd0-8ec8-d229a237a47c" ClientID string `json:"client_id"` // example "example-client" UserName string `json:"user_name"` // example "admin" Userid string `json:"user_id"` // example "84f6cffa-4505-48ec-a851-424160892283" Scope string `json:"scope"` // example "ME" RefreshTokenExpiresAt Timestamp `json:"refresh_token_expires_at"` // example 1479309001813 ExpiresAt Timestamp `json:"expires_at"` // example 1479251401814 ExpiresIn int `json:"expires_in"` // example 28795 }
Token represents an osiam auth token