Documentation ¶
Index ¶
- Variables
- type AuthAPI
- func (au AuthAPI) Approve(c *httputil.Context) error
- func (au AuthAPI) Authenticate(c *httputil.Context) error
- func (au AuthAPI) Register(c *httputil.Context) error
- func (au AuthAPI) Retrieve(c *httputil.Context) error
- func (au AuthAPI) RetrieveAll(c *httputil.Context) error
- func (au AuthAPI) Revoke(c *httputil.Context) error
- type Identity
- type IdentityPath
- type IdentityResponse
- type IdentityStatus
- type OAuthService
Constants ¶
This section is empty.
Variables ¶
var ( ErrIdentityNotFound = errors.New("Identity not found") ErrIdentityStillValid = errors.New("Identity Credentials Still Valid") ErrIdentityHasExpired = errors.New("Identity Credentials Has Expired") )
contains series of errors used for Authentication.
Functions ¶
This section is empty.
Types ¶
type AuthAPI ¶
type AuthAPI struct { Service OAuthService ServiceName string }
AuthAPI defines a core which exposes
func New ¶
func New(service OAuthService, serviceName string) AuthAPI
New returns a new instance of the AuthAPI.
func (AuthAPI) Approve ¶
Approve defines a function for approving a access token received from a request.
func (AuthAPI) Authenticate ¶
Authenticate defines a function to validate a received token against a existing oauth access record through the underline OAuthService.
func (AuthAPI) Register ¶
Register defines a function to create a new oauth request for the underline OAuthService.
func (AuthAPI) Retrieve ¶
Retrieve defines a function to return a existing oauth access record through the underline OAuthService.
func (AuthAPI) RetrieveAll ¶
RetrieveAll defines a function to return a existing oauth access record through the underline OAuthService.
type Identity ¶
type Identity struct { Identity string `json:"identity" bson:"identity"` TokenID string `json:"token_id" bson:"token_id"` PrivateID string `json:"private_id" bson:"private_id"` Token auth.Token `json:"token" bson:"token"` Status IdentityStatus `json:"status" bson:"status"` Data map[string]interface{} `json:"data" bson:"data"` }
Identity defines the response delivered to all request for the retrieval of a giving identity token details.
type IdentityPath ¶
type IdentityPath struct { Identity string `json:"identity" bson:"identity"` Login string `json:"login" bson:"login"` }
IdentityPath represent the response delivered when a giving oauth relay is called for a new user login.
type IdentityResponse ¶
type IdentityResponse struct { Code string `json:"code" bson:"code"` Identity string `json:"identity" bson:"identity"` Data map[string]interface{} `json:"data" bson:"data"` }
IdentityResponse defines a type that contains the initial response received to process a authentication/authorization login.
type IdentityStatus ¶
type IdentityStatus int
IdentityStatus defines the status int type which specifies the current state of a giving identity.
const ( Pending IdentityStatus = iota + 1 Resolved Expired )
Defines series of IdentityStatus types.
type OAuthService ¶
type OAuthService interface { Revoke(ctx context.Context, identity string) error Identities(ctx context.Context) ([]Identity, error) Get(ctx context.Context, identity string) (Identity, error) Approve(ctx context.Context, response IdentityResponse) error New(ctx context.Context, identity string, secret string) (string, error) Authenticate(ctx context.Context, identity string, bearerType string, token string) error }
OAuthService defines a API which exposes the consistent operations needed to both manage and deploy a oauth service, which will manage both OAuth authentication and retireve authorization from such service.