store

package
v0.0.0-...-b9b5e9f Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SessionAuthMethodPassword = "password"
	SessionAuthMethodOidc     = "oidc"
)

Variables

This section is empty.

Functions

func Clear

func Clear(db *gorm.DB) error

func Migrate

func Migrate(db *gorm.DB) error

Types

type AuthRequest

type AuthRequest struct {
	// ID is the unique id of the auth request
	ID string
	// CreatedAt is the time the AuthRequest was created
	CreatedAt time.Time
	// ClientID is the client id requesting authentication
	ClientID string
	// Identifier is the user-provided identifier
	Identifier string
	// IdentityProviderID is the upstream identity provider id
	IdentityProviderID *string
	// IdentityProvider is the upstream identity provider
	IdentityProvider *store.IdentityProvider
	// Scope is the client requested scope
	Scope string
	// LoginChallenge is the hydra login challenge
	LoginChallenge *string
	// ConsentChallenge is the hydra consent challenge
	ConsentChallenge *string
	// State is the oidc state variable
	State *string
	// IdentityID is the found identity ID
	IdentityID *string
	// Identity is the found identity
	Identity Identity
}

type Credential

type Credential struct {
	ID                  string
	CreatedAt           time.Time
	UpdatedAt           time.Time
	IdentityID          string
	Identity            *Identity
	Kind                CredentialKind
	HashedPassword      *string
	Issuer              *string
	Identifiers         []*CredentialIdentifier
	InitialAccessToken  *string
	InitialRefreshToken *string
	InitialIdToken      *string
}

type CredentialIdentifier

type CredentialIdentifier struct {
	ID           string
	CredentialID string
	Credential   *Credential
	Identifier   string
}

type CredentialKind

type CredentialKind string
const (
	PasswordCredential CredentialKind = "password"
	OidcCredential     CredentialKind = "oidc"
)

type Identity

type Identity struct {
	ID          string
	State       IdentityState
	Credentials []*Credential
}

type IdentityState

type IdentityState string
const (
	IdentityStateActive   IdentityState = "active"
	IdentityStateInactive IdentityState = "inactive"
)

type Interface

type Interface interface {
	GetAuthRequest(ctx context.Context, id string) (*AuthRequest, error)
	CreateAuthRequest(ctx context.Context, authRequest *AuthRequest) (*AuthRequest, error)
	UpdateAuthRequest(ctx context.Context, authRequest *AuthRequest) (*AuthRequest, error)
	GetIdentity(ctx context.Context, id string) (*Identity, error)
	FindOidcIdentifier(identifier string, identityProviderId string) (*CredentialIdentifier, error)
	CreateOidcIdentity(issuer string, identifier string, initialAccessToken string, initialRefreshToken string, initialIdToken string) (*Identity, error)
}

func NewStore

func NewStore(db store.Factory) Interface

type Session

type Session struct {
	ID              string
	Active          bool
	ExpiresAt       time.Time
	AuthenticatedAt time.Time
	IssuedAt        time.Time
	IdentityID      string
	Identity        Identity
}

type SessionAuthMethod

type SessionAuthMethod struct {
	ID          string
	SessionID   string
	Session     Session
	Method      SessionAuthMethodKind
	CompletedAt time.Time
}

type SessionAuthMethodKind

type SessionAuthMethodKind string

Jump to

Keyboard shortcuts

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