store

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2020 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewGOrmDB

func NewGOrmDB(dbType string, dsn string) (*gorm.DB, error)

Types

type ClientDBModel

type ClientDBModel struct {
	gorm.Model
	ClientID      string                 `gorm:"column:client_id;unique_index;not null;size:256"`
	ClientSecret  string                 `gorm:"column:client_secret;size:256"`
	Public        bool                   `gorm:"column:public;unique_index;not null"`
	Attributes    map[string]interface{} `gorm:"-"`
	AttributeData string                 `gorm:"column:attributes;type:lob"`
}

func NewClientDBModel

func NewClientDBModel() *ClientDBModel

func (*ClientDBModel) AfterFind

func (c *ClientDBModel) AfterFind() (err error)

func (*ClientDBModel) BeforeCreate

func (c *ClientDBModel) BeforeCreate() error

func (*ClientDBModel) GetApprovedGrantTypes

func (c *ClientDBModel) GetApprovedGrantTypes() oidcsdk.Arguments

func (*ClientDBModel) GetApprovedScopes

func (c *ClientDBModel) GetApprovedScopes() oidcsdk.Arguments

func (*ClientDBModel) GetAttribute

func (c *ClientDBModel) GetAttribute(key string) interface{}

func (*ClientDBModel) GetID

func (c *ClientDBModel) GetID() string

func (*ClientDBModel) GetIDTokenSigningAlg

func (c *ClientDBModel) GetIDTokenSigningAlg() jose.SignatureAlgorithm

func (*ClientDBModel) GetRedirectURIs

func (c *ClientDBModel) GetRedirectURIs() []string

func (*ClientDBModel) GetSecret

func (c *ClientDBModel) GetSecret() string

func (*ClientDBModel) IsPublic

func (c *ClientDBModel) IsPublic() bool

func (*ClientDBModel) SetApprovedGrantTypes

func (c *ClientDBModel) SetApprovedGrantTypes(gty oidcsdk.Arguments)

func (*ClientDBModel) SetApprovedScopes

func (c *ClientDBModel) SetApprovedScopes(scp oidcsdk.Arguments)

func (*ClientDBModel) SetAttribute

func (c *ClientDBModel) SetAttribute(key string, value interface{})

func (*ClientDBModel) SetIDTokenSigningAlg

func (c *ClientDBModel) SetIDTokenSigningAlg(alg jose.SignatureAlgorithm)

func (*ClientDBModel) SetRedirectURIs

func (c *ClientDBModel) SetRedirectURIs(uris []string)

func (*ClientDBModel) TableName

func (c *ClientDBModel) TableName() string

type ClientStore

type ClientStore struct {
	// contains filtered or unexported fields
}

func NewClientStore

func NewClientStore(db *gorm.DB) *ClientStore

func (*ClientStore) AutoMigrate

func (c *ClientStore) AutoMigrate()

func (*ClientStore) FetchClientProfile

func (c *ClientStore) FetchClientProfile(_ context.Context, clientId string) oidcsdk.RequestProfile

func (*ClientStore) GetClient

func (c *ClientStore) GetClient(_ context.Context, clientID string) (oidcsdk.IClient, error)

type KeyDBModel

type KeyDBModel struct {
	gorm.Model
	KID        string `gorm:"column:key_id;size:100;unique_index;not null"`
	Asymmetric bool   `gorm:"column:asymmetric;not null;size:50"`
	Algorithm  string `gorm:"column:algorithm;size:50"`
	Use        string `gorm:"column:use;size:10"`
	PrivateKey string `gorm:"column:private_key;type:lob"`
	PublicKey  string `gorm:"column:public_key;type:lob"`
	SecretKey  string `gorm:"column:secret_key;type:lob"`
}

func (*KeyDBModel) GetPrivateKey

func (km *KeyDBModel) GetPrivateKey() (interface{}, error)

func (*KeyDBModel) GetPublicKey

func (km *KeyDBModel) GetPublicKey() (interface{}, error)

func (*KeyDBModel) SetPrivateKey

func (km *KeyDBModel) SetPrivateKey(key interface{}) error

func (*KeyDBModel) SetPublicKey

func (km *KeyDBModel) SetPublicKey(key interface{}) error

func (*KeyDBModel) TableName

func (km *KeyDBModel) TableName() string

type KeyStore

type KeyStore struct {
	// contains filtered or unexported fields
}

func NewKeyStore

func NewKeyStore(db *gorm.DB) *KeyStore

func (*KeyStore) AutoMigrate

func (k *KeyStore) AutoMigrate()

func (*KeyStore) GetAllSecrets

func (k *KeyStore) GetAllSecrets() *jose.JSONWebKeySet

type TokenDBModel

type TokenDBModel struct {
	gorm.Model
	RequestID      string                 `gorm:"column:request_id;unique_index;size:60;default:null"`
	ATSignature    sql.NullString         `gorm:"column:at_signature;unique_index;default:null"`
	ACSignature    sql.NullString         `gorm:"column:ac_signature;unique_index;default:null"`
	RTSignature    sql.NullString         `gorm:"column:rt_signature;unique_index;default:null"`
	ACExpiry       time.Time              `gorm:"column:ac_expiry"`
	ATExpiry       time.Time              `gorm:"column:at_expiry"`
	RTExpiry       time.Time              `gorm:"column:rt_expiry"`
	ProfileData    string                 `gorm:"column:profile;type:lob"`
	RequestProfile oidcsdk.RequestProfile `gorm:"-"`
}

func (*TokenDBModel) AfterFind

func (t *TokenDBModel) AfterFind() (err error)

func (*TokenDBModel) BeforeCreate

func (t *TokenDBModel) BeforeCreate() error

func (*TokenDBModel) TableName

func (t *TokenDBModel) TableName() string

type TokenStore

type TokenStore struct {
	// contains filtered or unexported fields
}

func NewTokenStore

func NewTokenStore(db *gorm.DB) *TokenStore

func (*TokenStore) AutoMigrate

func (d *TokenStore) AutoMigrate()

func (*TokenStore) GetProfileWithAccessTokenSign

func (d *TokenStore) GetProfileWithAccessTokenSign(_ context.Context, signature string) (profile oidcsdk.RequestProfile, reqId string, err error)

func (*TokenStore) GetProfileWithAuthCodeSign

func (d *TokenStore) GetProfileWithAuthCodeSign(_ context.Context, signature string) (profile oidcsdk.RequestProfile, reqId string, err error)

func (*TokenStore) GetProfileWithRefreshTokenSign

func (d *TokenStore) GetProfileWithRefreshTokenSign(_ context.Context, signature string) (profile oidcsdk.RequestProfile, reqId string, err error)

func (*TokenStore) InvalidateWithRequestID

func (d *TokenStore) InvalidateWithRequestID(_ context.Context, reqID string, what uint8) (err error)

func (*TokenStore) StoreTokenProfile

func (d *TokenStore) StoreTokenProfile(_ context.Context, reqId string, signatures oidcsdk.TokenSignatures, profile oidcsdk.RequestProfile) (err error)

type UserDBModel

type UserDBModel struct {
	gorm.Model
	Username          string     `gorm:"column:username;unique_index;size:256;not null"`
	Password          string     `gorm:"column:password;size:256;not null"`
	Locked            bool       `gorm:"column:locked"`
	Blocked           bool       `gorm:"column:blocked"`
	WrongAttemptStart *time.Time `gorm:"column:wrong_attempt_start"`
	WrongAttemptCount uint8      `gorm:"column:wrong_attempt_count"`
}

func (*UserDBModel) TableName

func (t *UserDBModel) TableName() string

type UserStore

type UserStore struct {
	WrongAttemptWindow time.Duration
	WrongAttemptCount  uint8
	// contains filtered or unexported fields
}

func NewUserStore

func NewUserStore(db *gorm.DB) *UserStore

func (*UserStore) Authenticate

func (u *UserStore) Authenticate(_ context.Context, username string, credential []byte) (err error)

func (*UserStore) AutoMigrate

func (u *UserStore) AutoMigrate()

func (*UserStore) FetchUserProfile

func (u *UserStore) FetchUserProfile(_ context.Context, username string) oidcsdk.RequestProfile

func (*UserStore) GetClaims

func (u *UserStore) GetClaims(context.Context, string, oidcsdk.Arguments, []string) (map[string]interface{}, error)

func (*UserStore) IsConsentRequired

func (u *UserStore) IsConsentRequired(context.Context, string, string, oidcsdk.Arguments) bool

func (*UserStore) StoreConsent

Jump to

Keyboard shortcuts

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