fosite: github.com/ory/fosite/storage Index | Files

package storage

import "github.com/ory/fosite/storage"

Index

Package Files

memory.go transactional.go

func MaybeBeginTx Uses

func MaybeBeginTx(ctx context.Context, storage interface{}) (context.Context, error)

MaybeBeginTx is a helper function that can be used to initiate a transaction if the supplied storage implements the `Transactional` interface.

func MaybeCommitTx Uses

func MaybeCommitTx(ctx context.Context, storage interface{}) error

MaybeCommitTx is a helper function that can be used to commit a transaction if the supplied storage implements the `Transactional` interface.

func MaybeRollbackTx Uses

func MaybeRollbackTx(ctx context.Context, storage interface{}) error

MaybeRollbackTx is a helper function that can be used to rollback a transaction if the supplied storage implements the `Transactional` interface.

type MemoryStore Uses

type MemoryStore struct {
    Clients        map[string]fosite.Client
    AuthorizeCodes map[string]StoreAuthorizeCode
    IDSessions     map[string]fosite.Requester
    AccessTokens   map[string]fosite.Requester
    Implicit       map[string]fosite.Requester
    RefreshTokens  map[string]fosite.Requester
    PKCES          map[string]fosite.Requester
    Users          map[string]MemoryUserRelation
    // In-memory request ID to token signatures
    AccessTokenRequestIDs  map[string]string
    RefreshTokenRequestIDs map[string]string
}

func NewExampleStore Uses

func NewExampleStore() *MemoryStore

func NewMemoryStore Uses

func NewMemoryStore() *MemoryStore

func (*MemoryStore) Authenticate Uses

func (s *MemoryStore) Authenticate(_ context.Context, name string, secret string) error

func (*MemoryStore) CreateAccessTokenSession Uses

func (s *MemoryStore) CreateAccessTokenSession(_ context.Context, signature string, req fosite.Requester) error

func (*MemoryStore) CreateAuthorizeCodeSession Uses

func (s *MemoryStore) CreateAuthorizeCodeSession(_ context.Context, code string, req fosite.Requester) error

func (*MemoryStore) CreateImplicitAccessTokenSession Uses

func (s *MemoryStore) CreateImplicitAccessTokenSession(_ context.Context, code string, req fosite.Requester) error

func (*MemoryStore) CreateOpenIDConnectSession Uses

func (s *MemoryStore) CreateOpenIDConnectSession(_ context.Context, authorizeCode string, requester fosite.Requester) error

func (*MemoryStore) CreatePKCERequestSession Uses

func (s *MemoryStore) CreatePKCERequestSession(_ context.Context, code string, req fosite.Requester) error

func (*MemoryStore) CreateRefreshTokenSession Uses

func (s *MemoryStore) CreateRefreshTokenSession(_ context.Context, signature string, req fosite.Requester) error

func (*MemoryStore) DeleteAccessTokenSession Uses

func (s *MemoryStore) DeleteAccessTokenSession(_ context.Context, signature string) error

func (*MemoryStore) DeleteAuthorizeCodeSession Uses

func (s *MemoryStore) DeleteAuthorizeCodeSession(_ context.Context, code string) error

func (*MemoryStore) DeleteOpenIDConnectSession Uses

func (s *MemoryStore) DeleteOpenIDConnectSession(_ context.Context, authorizeCode string) error

func (*MemoryStore) DeletePKCERequestSession Uses

func (s *MemoryStore) DeletePKCERequestSession(_ context.Context, code string) error

func (*MemoryStore) DeleteRefreshTokenSession Uses

func (s *MemoryStore) DeleteRefreshTokenSession(_ context.Context, signature string) error

func (*MemoryStore) GetAccessTokenSession Uses

func (s *MemoryStore) GetAccessTokenSession(_ context.Context, signature string, _ fosite.Session) (fosite.Requester, error)

func (*MemoryStore) GetAuthorizeCodeSession Uses

func (s *MemoryStore) GetAuthorizeCodeSession(_ context.Context, code string, _ fosite.Session) (fosite.Requester, error)

func (*MemoryStore) GetClient Uses

func (s *MemoryStore) GetClient(_ context.Context, id string) (fosite.Client, error)

func (*MemoryStore) GetOpenIDConnectSession Uses

func (s *MemoryStore) GetOpenIDConnectSession(_ context.Context, authorizeCode string, requester fosite.Requester) (fosite.Requester, error)

func (*MemoryStore) GetPKCERequestSession Uses

func (s *MemoryStore) GetPKCERequestSession(_ context.Context, code string, _ fosite.Session) (fosite.Requester, error)

func (*MemoryStore) GetRefreshTokenSession Uses

func (s *MemoryStore) GetRefreshTokenSession(_ context.Context, signature string, _ fosite.Session) (fosite.Requester, error)

func (*MemoryStore) InvalidateAuthorizeCodeSession Uses

func (s *MemoryStore) InvalidateAuthorizeCodeSession(ctx context.Context, code string) error

func (*MemoryStore) RevokeAccessToken Uses

func (s *MemoryStore) RevokeAccessToken(ctx context.Context, requestID string) error

func (*MemoryStore) RevokeRefreshToken Uses

func (s *MemoryStore) RevokeRefreshToken(ctx context.Context, requestID string) error

type MemoryUserRelation Uses

type MemoryUserRelation struct {
    Username string
    Password string
}

type StoreAuthorizeCode Uses

type StoreAuthorizeCode struct {
    fosite.Requester
    // contains filtered or unexported fields
}

type Transactional Uses

type Transactional interface {
    BeginTX(ctx context.Context) (context.Context, error)
    Commit(ctx context.Context) error
    Rollback(ctx context.Context) error
}

A storage provider that has support for transactions should implement this interface to ensure atomicity for certain flows that require transactional semantics. Fosite will call these methods (when atomicity is required) if and only if the storage provider has implemented `Transactional`. It is expected that the storage provider will examine context for an existing transaction each time a database operation is to be performed.

An implementation of `BeginTX` should attempt to initiate a new transaction and store that under a unique key in the context that can be accessible by `Commit` and `Rollback`. The "transactional aware" context will then be returned for further propagation, eventually to be consumed by `Commit` or `Rollback` to finish the transaction.

Implementations for `Commit` & `Rollback` should look for the transaction object inside the supplied context using the same key used by `BeginTX`. If these methods have been called, it is expected that a txn object should be available in the provided context.

Package storage imports 3 packages (graph) and is imported by 21 packages. Updated 2018-12-24. Refresh now. Tools for package owners.