oauth

package
v0.0.0-...-e647751 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2022 License: GPL-3.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccessGenerator

type AccessGenerator struct {
	Issuer       string
	SignedKeyID  string
	SignedKey    *ecdsa.PrivateKey
	SignedMethod jwt.SigningMethod
	// contains filtered or unexported fields
}

AccessGenerator generate the jwt access token.

func (*AccessGenerator) Token

func (a *AccessGenerator) Token(ctx context.Context, data *oauth2.GenerateBasic, isGenRefresh bool) (string, string, error)

Token based on the UUID generated token.

type AdapterClientStore

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

AdapterClientStore adapts our database interface to the client store interface.

func NewAdapterClientStore

func NewAdapterClientStore(d db.DB, t *token.Tokenizer) *AdapterClientStore

NewAdapterClientStore creates a new client store adapter.

func (*AdapterClientStore) GetByID

func (c *AdapterClientStore) GetByID(ctx context.Context, tok string) (oauth2.ClientInfo, error)

GetByID returns a client based on an ID.

type JWTAccessClaims

type JWTAccessClaims struct {
	jwt.StandardClaims

	Nonce string `json:"nonce,omitempty"`
}

JWTAccessClaims jwt claims.

func (*JWTAccessClaims) Valid

func (a *JWTAccessClaims) Valid() error

Valid claims verification.

type Keychain

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

Keychain holds signing keys for.

func NewKeychain

func NewKeychain() (*Keychain, error)

NewKeychain creates a new oauth keychain.

type Server

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

Server is an oauth server.

func New

func New(_ context.Context, d db.DB, r *redis.Client, t *token.Tokenizer) (*Server, error)

New returns a new oauth server.Server object.

func (*Server) GetECPrivateKey

func (s *Server) GetECPrivateKey() *ecdsa.PrivateKey

GetECPrivateKey returns an ecdsa.PrivateKey.

func (*Server) GetECPublicKey

func (s *Server) GetECPublicKey() *ecdsa.PublicKey

GetECPublicKey returns a crypto.PublicKey compatable version of the public key.

func (*Server) GetECPublicKeyID

func (s *Server) GetECPublicKeyID() string

GetECPublicKeyID returns the generated.

func (*Server) HandleAuthorizeRequest

func (s *Server) HandleAuthorizeRequest(uid int64, w nethttp.ResponseWriter, r *nethttp.Request) error

HandleAuthorizeRequest passes an authorize request to the oauth server.

func (*Server) HandleTokenRequest

func (s *Server) HandleTokenRequest(w nethttp.ResponseWriter, r *nethttp.Request) error

HandleTokenRequest passes a token request to the oauth server.

func (*Server) NewAccessGenerator

func (s *Server) NewAccessGenerator(k kv.KV, issuer string, method jwt.SigningMethod) (*AccessGenerator, error)

NewAccessGenerator creates a new access token generator.

func (*Server) SetUserAuthorizationHandler

func (s *Server) SetUserAuthorizationHandler(h server.UserAuthorizationHandler)

SetUserAuthorizationHandler sets the UserAuthorizationHandler on the OAuth server.

Jump to

Keyboard shortcuts

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