Documentation ¶
Overview ¶
Package clory provides ory-powered auth functionality.
Index ¶
Constants ¶
const AnonymousIdentityID = "00000000-0000-4000-8000-000000000002"
AnonymousIdentityID declares the special identity id for anonymous users.
const AnonymousSessionID = "00000000-0000-4000-8000-000000000001"
AnonymousSessionID declares the special session id for anonymous session.
Variables ¶
var AnonymousSession = &orysdk.Session{ Id: AnonymousSessionID, Active: orysdk.PtrBool(true), Identity: &orysdk.Identity{Id: AnonymousIdentityID}, }
AnonymousSession is returned from authentication calls when they fail but anonymous access is allowed.
var ErrUnauthenticated = errors.New("unauthenticated")
ErrUnauthenticated defines an error for failing to authenticate.
Functions ¶
func NewClientAPIs ¶
func NewClientAPIs(cfg Config) (FrontendAPI, PermissionAPI)
NewClientAPIs inits the raw Ory SDK API Client.
Types ¶
type Config ¶
type Config struct { // Ory endpoint. Endpoint *url.URL `env:"ENDPOINT" envDefault:"http://localhost:4000"` }
Config configures this package.
type FrontendAPI ¶
type FrontendAPI interface { ToSession(ctx context.Context) orysdk.FrontendAPIToSessionRequest ToSessionExecute(r orysdk.FrontendAPIToSessionRequest) (*orysdk.Session, *http.Response, error) }
FrontendAPI describe the external interface.
type Ory ¶
type Ory struct {
// contains filtered or unexported fields
}
Ory auth module.
func New ¶
func New(cfg Config, logs *zap.Logger, front FrontendAPI, perm PermissionAPI) *Ory
New inits the ory auth module.
func (Ory) Authenticate ¶ added in v0.25.6
func (o Ory) Authenticate(ctx context.Context, cookie string, allowAnonymous bool) (*orysdk.Session, error)
Authenticate implements the core authentication logic. The function that actually interacts with Ory is passed in for easier testing.
func (Ory) BrowserLoginURL ¶
BrowserLoginURL returns the url for starting the login flow.
type PermissionAPI ¶ added in v0.25.6
type PermissionAPI interface { CheckPermission(ctx context.Context) orysdk.PermissionAPICheckPermissionRequest CheckPermissionExecute(r orysdk.PermissionAPICheckPermissionRequest) ( *orysdk.CheckPermissionResult, *http.Response, error) }
PermissionAPI describe the external interface.