client

package
v0.0.0-...-a6f7f21 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StorageKeySignInSession  = "logto_sign_in_session"
	StorageKeyRefreshToken   = "logto_refresh_token"
	StorageKeyIdToken        = "logto_id_token"
	StorageKeyAccessTokenMap = "logto_access_token_map"
)

Variables

View Source
var (
	ErrNotAuthenticated            = errors.New("not authenticated")
	ErrUnacknowledgedResourceFound = errors.New("unacknowledged resource found")
	ErrMissingScopeOrganizations   = errors.New("missing 'urn:logto:scope:organizations' scope")
)

Functions

func GetOriginRequestUrl

func GetOriginRequestUrl(request *http.Request) string

Types

type AccessToken

type AccessToken struct {
	Token     string `json:"token"`
	Scope     string `json:"scope"`
	ExpiresAt int64  `json:"expiresAt"`
}

type LogtoClient

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

func NewLogtoClient

func NewLogtoClient(config *LogtoConfig, storage Storage) *LogtoClient

func (*LogtoClient) FetchUserInfo

func (logtoClient *LogtoClient) FetchUserInfo() (core.UserInfoResponse, error)

func (*LogtoClient) GetAccessToken

func (logtoClient *LogtoClient) GetAccessToken(resource string) (AccessToken, error)

func (*LogtoClient) GetIdToken

func (LogtoClient *LogtoClient) GetIdToken() string

func (*LogtoClient) GetIdTokenClaims

func (logtoClient *LogtoClient) GetIdTokenClaims() (core.IdTokenClaims, error)

func (*LogtoClient) GetOrganizationToken

func (logtoClient *LogtoClient) GetOrganizationToken(organizationId string) (AccessToken, error)

func (*LogtoClient) GetOrganizationTokenClaims

func (logtoClient *LogtoClient) GetOrganizationTokenClaims(organizationId string) (core.OrganizationAccessTokenClaims, error)

func (*LogtoClient) GetRefreshToken

func (logtoClient *LogtoClient) GetRefreshToken() string

func (*LogtoClient) HandleSignInCallback

func (logtoClient *LogtoClient) HandleSignInCallback(request *http.Request) error

func (*LogtoClient) IsAuthenticated

func (logtoClient *LogtoClient) IsAuthenticated() bool

func (*LogtoClient) SaveAccessToken

func (logtoClient *LogtoClient) SaveAccessToken(key string, accessToken AccessToken)

func (*LogtoClient) SetIdToken

func (logtoClient *LogtoClient) SetIdToken(idToken string)

func (*LogtoClient) SetRefreshToken

func (logtoClient *LogtoClient) SetRefreshToken(refreshToken string)

func (*LogtoClient) SignIn

func (logtoClient *LogtoClient) SignIn(redirectUri string) (string, error)

func (*LogtoClient) SignOut

func (logtoClient *LogtoClient) SignOut(postLogoutRedirectUri string) (string, error)

type LogtoConfig

type LogtoConfig struct {
	Endpoint  string
	AppId     string
	AppSecret string
	Scopes    []string
	Resources []string
	Prompt    string
}

type SignInSession

type SignInSession struct {
	RedirectUri   string
	CodeVerifier  string
	CodeChallenge string
	State         string
}

type Storage

type Storage interface {
	GetItem(key string) string
	SetItem(key, value string)
}

Jump to

Keyboard shortcuts

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