Documentation ¶
Overview ¶
Package nonpersistent implements an in-memory (non-persistent) data store. It implements all of the Storer interfaces, so it can be used for any and all LTI data.
Index ¶
- type Store
- func (s *Store) FindAccessToken(tokenURI, clientID string, scopes []string) (datastore.AccessToken, error)
- func (s *Store) FindDeployment(issuer, deploymentID string) (datastore.Deployment, error)
- func (s *Store) FindLaunchData(launchID string) (json.RawMessage, error)
- func (s *Store) FindRegistrationByIssuerAndClientID(issuer, clientID string) (datastore.Registration, error)
- func (s *Store) StoreAccessToken(token datastore.AccessToken) error
- func (s *Store) StoreDeployment(issuer string, d datastore.Deployment) error
- func (s *Store) StoreLaunchData(launchID string, launchData json.RawMessage) error
- func (s *Store) StoreNonce(nonce, targetLinkURI string) error
- func (s *Store) StoreRegistration(reg datastore.Registration) error
- func (s *Store) TestAndClearNonce(nonce, targetLinkURI string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Store ¶
type Store struct { Registrations *sync.Map Deployments *sync.Map Nonces *sync.Map LaunchData *sync.Map AccessTokens *sync.Map }
Store implements an in-memory datastore.
DefaultStore provides a single default datastore as a package variable so that other LTI functions can fall back on this datastore whenever the user does not explicitly specify a datastore.
func (*Store) FindAccessToken ¶
func (s *Store) FindAccessToken(tokenURI, clientID string, scopes []string) (datastore.AccessToken, error)
FindAccessToken retrieves bearer tokens for potential reuse.
func (*Store) FindDeployment ¶
func (s *Store) FindDeployment(issuer, deploymentID string) (datastore.Deployment, error)
FindDeployment looks up and returns either a Deployment by the issuer and deployment ID or the datastore error ErrDeploymentNotFound.
func (*Store) FindLaunchData ¶
func (s *Store) FindLaunchData(launchID string) (json.RawMessage, error)
FindLaunchData retrieves a cached launchData.
func (*Store) FindRegistrationByIssuerAndClientID ¶
func (s *Store) FindRegistrationByIssuerAndClientID(issuer, clientID string) (datastore.Registration, error)
FindRegistrationByIssuerAndClientID looks up and returns either a Registration by the issuer or the datastore error ErrRegistrationNotFound.
func (*Store) StoreAccessToken ¶
func (s *Store) StoreAccessToken(token datastore.AccessToken) error
StoreAccessToken stores bearer tokens for potential reuse.
func (*Store) StoreDeployment ¶
func (s *Store) StoreDeployment(issuer string, d datastore.Deployment) error
StoreDeployment stores a deployment ID in-memory.
func (*Store) StoreLaunchData ¶
func (s *Store) StoreLaunchData(launchID string, launchData json.RawMessage) error
StoreLaunchData stores the launch data, i.e. the id_token JWT.
func (*Store) StoreNonce ¶
StoreNonce stores a Nonce in-memory. Since the nonce and target_link_uri values have similarly scoped verifications required, use the the unique nonce value as a key to store the target_link_uri value. This is used to verify the OIDC login request target_link_uri is the same as the claim of the same name in the launch id_token.
func (*Store) StoreRegistration ¶
func (s *Store) StoreRegistration(reg datastore.Registration) error
StoreRegistration stores a Registration in-memory.
func (*Store) TestAndClearNonce ¶
TestAndClearNonce looks up a nonce, clears the entry if found, and returns whether it was found via the error return. If the nonce wasn't found, it returns the datastore error ErrNonceNotFound. If it was found, it returns nil.