examples

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package examples provides ...

Package examples provides ...

Package examples provides ...

Index

Constants

This section is empty.

Variables

Signer for crypto

Functions

This section is empty.

Types

type TestClient

type TestClient struct {
	ID       string
	Secret   string
	Redirect string
	Type     protocol.ClientType
}

TestClient oidc

func (*TestClient) ClientID

func (c *TestClient) ClientID() string

ClientID return client id

func (*TestClient) ClientSecret

func (c *TestClient) ClientSecret() string

ClientSecret return client secret

func (*TestClient) ClientType

func (c *TestClient) ClientType() protocol.ClientType

ClientType return client type

func (*TestClient) DeviceAuthPath

func (c *TestClient) DeviceAuthPath() string

DeviceAuthPath device authorize path

func (*TestClient) ExpirationOptions

func (c *TestClient) ExpirationOptions() protocol.Expirations

ExpirationOptions client expirations, seconds

func (*TestClient) GrantTypes

func (c *TestClient) GrantTypes() []protocol.GrantType

GrantTypes grant types

func (*TestClient) IsScopeAllowed

func (c *TestClient) IsScopeAllowed(scope string) bool

IsScopeAllowed allowed scopes

func (*TestClient) JWTSigningMethod

func (c *TestClient) JWTSigningMethod() jwt.SigningMethod

JWTSigningMethod sign with idtoken

func (*TestClient) PrivateKey

func (c *TestClient) PrivateKey() (crypto.Signer, error)

PrivateKey loads the client private key

func (*TestClient) RedirectURI

func (c *TestClient) RedirectURI() string

RedirectURI return client redirect uri, multiple URLs by comma-separating

func (*TestClient) ResponseTypes

func (c *TestClient) ResponseTypes() []protocol.ResponseType

ResponseTypes allowed authorize type

type TestSession

type TestSession struct{}

TestSession test

func (*TestSession) AllowedOrigin

func (s *TestSession) AllowedOrigin() string

AllowedOrigin is that postMessage from op host

func (*TestSession) SessionExpiresIn

func (s *TestSession) SessionExpiresIn(cookie string) int

SessionExpiresIn user session expires with cookie

type TestStorage

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

TestStorage storage

func NewTestStorage

func NewTestStorage() *TestStorage

NewTestStorage memory storage

func (*TestStorage) Client

func (s *TestStorage) Client(clientID string) (protocol.Client, error)

Client loads the client by id (client_id)

func (*TestStorage) LoadAccess

func (s *TestStorage) LoadAccess(token string) (data *protocol.AccessData, err error)

LoadAccess retrieves access data by token. Client information MUST be loaded together. AuthorizeData and AccessData DON'T NEED to be loaded if not easily available. Optionally can return error if expired.

func (*TestStorage) LoadAuthorize

func (s *TestStorage) LoadAuthorize(code string) (data *protocol.AuthorizeData, err error)

LoadAuthorize looks up AuthorizeData by a code. Client information MUST be loaded together. Optionally can return error if expired.

func (*TestStorage) LoadRefresh

func (s *TestStorage) LoadRefresh(refresh string) (data *protocol.AccessData, err error)

LoadRefresh retrieves refresh AccessData. Client information MUST be loaded together. AuthorizeData and AccessData DON'T NEED to be loaded if not easily available. Optionally can return error if expired.

func (*TestStorage) RemoveAccess

func (s *TestStorage) RemoveAccess(token string) error

RemoveAccess revokes or deletes an AccessData.

func (*TestStorage) RemoveAuthorize

func (s *TestStorage) RemoveAuthorize(code string) error

RemoveAuthorize revokes or deletes the authorization code.

func (*TestStorage) RemoveRefresh

func (s *TestStorage) RemoveRefresh(refresh string) error

RemoveRefresh revokes or deletes refresh AccessData.

func (*TestStorage) SaveAccess

func (s *TestStorage) SaveAccess(token string, data *protocol.AccessData, exp int) error

SaveAccess writes AccessData. If RefreshToken is not blank, it must save in a way that can be loaded using LoadRefresh.

func (*TestStorage) SaveAuthorize

func (s *TestStorage) SaveAuthorize(code string, data *protocol.AuthorizeData, exp int) error

SaveAuthorize saves authorize data.

func (*TestStorage) SaveRefresh

func (s *TestStorage) SaveRefresh(refresh, token string, exp int) (err error)

SaveRefresh save refresh token

func (*TestStorage) UserDataScopes

func (s *TestStorage) UserDataScopes(uid string, scopes []protocol.Scope) (*protocol.UserInfo, error)

UserDataScopes get user info from scopes

Directories

Path Synopsis
Package main provides ...
Package main provides ...
Package main provides ...
Package main provides ...

Jump to

Keyboard shortcuts

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