service

package
v0.0.0-...-6d3478e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 16, 2018 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
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

func (au AuthAPI) Approve(c *httputil.Context) error

Approve defines a function for approving a access token received from a request.

func (AuthAPI) Authenticate

func (au AuthAPI) Authenticate(c *httputil.Context) error

Authenticate defines a function to validate a received token against a existing oauth access record through the underline OAuthService.

func (AuthAPI) Register

func (au AuthAPI) Register(c *httputil.Context) error

Register defines a function to create a new oauth request for the underline OAuthService.

func (AuthAPI) Retrieve

func (au AuthAPI) Retrieve(c *httputil.Context) error

Retrieve defines a function to return a existing oauth access record through the underline OAuthService.

func (AuthAPI) RetrieveAll

func (au AuthAPI) RetrieveAll(c *httputil.Context) error

RetrieveAll defines a function to return a existing oauth access record through the underline OAuthService.

func (AuthAPI) Revoke

func (au AuthAPI) Revoke(c *httputil.Context) error

Revoke defines a function to revoke a existing oauth access for 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.

Directories

Path Synopsis
providers

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL