repository

package
v0.1.0-alpha.5 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2024 License: MIT Imports: 7 Imported by: 35

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckJWT

func CheckJWT(token string) error

CheckJWT checks if the token is a valid JWT

func GetExpiresIn

func GetExpiresIn(repository TokenRepository) (*int32, error)

func GetRefreshExpiresIn

func GetRefreshExpiresIn(repository TokenRepository) (int32, error)

func GetRefreshToken

func GetRefreshToken(repository TokenRepository) (string, error)

func GetSecondsTillExpiry

func GetSecondsTillExpiry(repository TokenRepository, refreshRate float64) time.Duration

func GetSecondsTillExpiryRefresh

func GetSecondsTillExpiryRefresh(repository TokenRepository, refreshRate float64) time.Duration

func HasRefreshTokenExpired

func HasRefreshTokenExpired(repository TokenRepository, refreshRate float64) bool

func HasToken

func HasToken(repository TokenRepository) bool

func HasTokenExpired

func HasTokenExpired(repository TokenRepository, refreshRate float64) bool

Types

type AccountCommonJWTBanV3

type AccountCommonJWTBanV3 struct {
	Ban               *string          `json:"ban"`
	DisabledDate      *strfmt.DateTime `json:"disabledDate,omitempty"`
	Enabled           *bool            `json:"enabled"`
	EndDate           strfmt.DateTime  `json:"endDate"`
	TargetedNamespace *string          `json:"targetedNamespace"`
}

type AccountCommonNamespaceRole

type AccountCommonNamespaceRole struct {
	Namespace *string `json:"namespace"`
	RoleID    *string `json:"roleId"`
}

type AccountCommonPermissionV3

type AccountCommonPermissionV3 struct {
	Action      *int32   `json:"action"`
	Resource    *string  `json:"resource"`
	SchedAction int32    `json:"schedAction,omitempty"`
	SchedCron   string   `json:"schedCron,omitempty"`
	SchedRange  []string `json:"schedRange"`
}

type ConfigRepository

type ConfigRepository interface {
	GetClientId() string
	GetClientSecret() string
	GetJusticeBaseUrl() string
}

type ExtendedConfigRepository

type ExtendedConfigRepository interface {
	ConfigRepository
	GetCustomBasePath(servicePath string) string
}

type ObservableTokenRepository

type ObservableTokenRepository interface {
	TokenRepository
	RegisterObserver(observer *TokenRepositoryObserver) bool
	UnregisterObserver(observer *TokenRepositoryObserver) bool
}

type RefreshTokenRepository

type RefreshTokenRepository interface {
	DisableAutoRefresh() bool
	GetRefreshRate() float64
	SetRefreshIsRunningInBackground(b bool)
}

type Token

type Token struct {
	AccessToken      *string                       `json:"access_token,omitempty"`
	AuthTrustID      string                        `json:"auth_trust_id,omitempty"`
	Bans             []*AccountCommonJWTBanV3      `json:"bans"`
	DisplayName      string                        `json:"display_name,omitempty"`
	ExpiresIn        *int32                        `json:"expires_in,omitempty"`
	IsComply         bool                          `json:"is_comply"`
	Jflgs            int32                         `json:"jflgs,omitempty"`
	Namespace        *string                       `json:"namespace"`
	NamespaceRoles   []*AccountCommonNamespaceRole `json:"namespace_roles"`
	Permissions      []*AccountCommonPermissionV3  `json:"permissions"`
	PlatformID       string                        `json:"platform_id,omitempty"`
	PlatformUserID   string                        `json:"platform_user_id,omitempty"`
	RefreshExpiresIn int32                         `json:"refresh_expires_in,omitempty"`
	RefreshToken     string                        `json:"refresh_token,omitempty"`
	Roles            []string                      `json:"roles"`
	Scope            *string                       `json:"scope"`
	TokenType        *string                       `json:"token_type"`
	UserID           string                        `json:"user_id,omitempty"`
	Xuid             string                        `json:"xuid,omitempty"`
}

Token this is created to remove dependency to 'iam-sdk' references: iam-sdk/pkg/iamclientmodels.OauthmodelTokenResponseV3 iam-sdk/pkg/iamclientmodels/.OauthmodelTokenWithDeviceCookieResponseV3

func ConvertInterfaceToModel

func ConvertInterfaceToModel(tokenInterface interface{}) (*Token, error)

func ConvertStringToModelToken

func ConvertStringToModelToken(accessToken string) (*Token, error)

ConvertStringToModelToken converts access token string to Token struct used by iam Token Grant V3 endpoint

type TokenRepository

type TokenRepository interface {
	// Store token model with type iamclientmodels.OauthmodelTokenResponseV3 or any type that compatible with its json serialized data
	Store(token interface{}) error
	GetToken() (*Token, error)
	RemoveToken() error
	TokenIssuedTimeUTC() time.Time
}

type TokenRepositoryObserver

type TokenRepositoryObserver interface {
	OnAccessTokenChanged(accessToken string) error
}

Jump to

Keyboard shortcuts

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