token

package
v0.6.9 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2024 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package token provides policy wrappers / getters for queries and mutations during password reset, signup

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrIncorrectEmail   = errors.New("privacy token has incorrect email")
	ErrInvalidTokenType = errors.New("invalid token type")
)

Functions

func NewContextWithOauthTooToken added in v0.3.0

func NewContextWithOauthTooToken(parent context.Context, email string) context.Context

NewContextWithOauthTooToken creates a new context with a oauth2 token. It takes a parent context and a oauth2 token as parameters and returns a new context with the oauth2 token added

func NewContextWithOrgInviteToken added in v0.2.6

func NewContextWithOrgInviteToken(parent context.Context, orgInviteToken string) context.Context

NewContextWithOrgInviteToken returns a new context with the reset token inside

func NewContextWithResetToken

func NewContextWithResetToken(parent context.Context, resetToken string) context.Context

NewContextWithResetToken returns a new context with the reset token inside

func NewContextWithSignUpToken

func NewContextWithSignUpToken(parent context.Context, email string) context.Context

NewContextWithSignUpToken creates a new context with a sign-up token. It takes a parent context and a sign-up token as parameters and returns a new context with the sign-up token added

func NewContextWithVerifyToken

func NewContextWithVerifyToken(parent context.Context, verifyToken string) context.Context

NewContextWithVerifyToken returns a new context with the verify token inside

Types

type OauthTooToken added in v0.3.0

type OauthTooToken struct {
	PrivacyToken
	// contains filtered or unexported fields
}

OauthTooToken that implements the PrivacyToken interface

func NewOauthTooWithEmail added in v0.3.0

func NewOauthTooWithEmail(email string) OauthTooToken

NewOauthTooWithEmail creates a new PrivacyToken of type OauthTooToken with email set

func OauthTooTokenFromContext added in v0.3.0

func OauthTooTokenFromContext(ctx context.Context) *OauthTooToken

OauthTooTokenFromContext retrieves the value associated with the oauthTooTokenKey key from the context. It then type asserts the value to an OauthTooToken and returns it. If the value is not of type OauthTooToken, it returns nil

func (OauthTooToken) GetContextKey added in v0.3.0

func (OauthTooToken) GetContextKey() interface{}

GetContextKey from OauthTooToken

func (*OauthTooToken) GetEmail added in v0.3.0

func (token *OauthTooToken) GetEmail() string

GetEmail from oauth2 token

func (*OauthTooToken) SetEmail added in v0.3.0

func (token *OauthTooToken) SetEmail(email string)

SetEmail on the oauth2 token

type OrgInviteToken added in v0.2.6

type OrgInviteToken struct {
	PrivacyToken
	// contains filtered or unexported fields
}

OrgInviteToken that implements the PrivacyToken interface

func NewOrgInviteTokenWithToken added in v0.2.6

func NewOrgInviteTokenWithToken(token string) OrgInviteToken

NewOrgInviteTokenWithToken creates a new PrivacyToken of type OrgInviteToken with token set

func OrgInviteTokenFromContext added in v0.2.6

func OrgInviteTokenFromContext(ctx context.Context) *OrgInviteToken

OrgInviteTokenFromContext parses a context for a reset token and returns the token

func (OrgInviteToken) GetContextKey added in v0.2.6

func (OrgInviteToken) GetContextKey() interface{}

GetContextKey from OrgInviteToken

func (*OrgInviteToken) GetToken added in v0.2.6

func (token *OrgInviteToken) GetToken() string

GetToken from invite token

func (*OrgInviteToken) SetToken added in v0.2.6

func (token *OrgInviteToken) SetToken(t string)

SetToken on the invite token

type PrivacyToken

type PrivacyToken interface {
	GetContextKey() interface{}
}

PrivacyToken interface

type ResetToken

type ResetToken struct {
	PrivacyToken
	// contains filtered or unexported fields
}

ResetToken that implements the PrivacyToken interface

func NewResetTokenWithToken

func NewResetTokenWithToken(token string) ResetToken

NewResetTokenWithToken creates a new PrivacyToken of type ResetToken with token set

func ResetTokenFromContext

func ResetTokenFromContext(ctx context.Context) *ResetToken

ResetTokenFromContext parses a context for a reset token and returns the token

func (ResetToken) GetContextKey

func (ResetToken) GetContextKey() interface{}

GetContextKey from ResetToken

func (*ResetToken) GetToken

func (token *ResetToken) GetToken() string

GetToken from reset token

func (*ResetToken) SetToken

func (token *ResetToken) SetToken(t string)

SetToken on the reset token

type SignUpToken

type SignUpToken struct {
	PrivacyToken
	// contains filtered or unexported fields
}

SignUpToken that implements the PrivacyToken interface

func EmailSignUpTokenFromContext

func EmailSignUpTokenFromContext(ctx context.Context) *SignUpToken

EmailSignUpTokenFromContext retrieves the value associated with the signUpTokenKey key from the context. It then type asserts the value to an EmailSignUpToken and returns it. If the value is not of type EmailSignUpToken, it returns nil

func NewSignUpTokenWithEmail

func NewSignUpTokenWithEmail(email string) SignUpToken

NewSignUpTokenWithEmail creates a new PrivacyToken of type SignUpToken with email set

func (SignUpToken) GetContextKey

func (SignUpToken) GetContextKey() interface{}

GetContextKey from SignUpToken

func (*SignUpToken) GetEmail

func (token *SignUpToken) GetEmail() string

GetEmail from sign-up token

func (*SignUpToken) SetEmail

func (token *SignUpToken) SetEmail(email string)

SetEmail on the sign-up token

type VerifyToken

type VerifyToken struct {
	PrivacyToken
	// contains filtered or unexported fields
}

VerifyToken that implements the PrivacyToken interface

func NewVerifyTokenWithToken

func NewVerifyTokenWithToken(token string) VerifyToken

NewVerifyTokenWithToken creates a new PrivacyToken of type SignUpToken with email set

func VerifyTokenFromContext

func VerifyTokenFromContext(ctx context.Context) *VerifyToken

VerifyTokenFromContext parses a context for a verify token and returns the token

func (VerifyToken) GetContextKey

func (VerifyToken) GetContextKey() interface{}

GetContextKey from VerifyToken

func (*VerifyToken) GetToken

func (token *VerifyToken) GetToken() string

GetToken from verify token

func (*VerifyToken) SetToken

func (token *VerifyToken) SetToken(t string)

SetToken on the verify token

Jump to

Keyboard shortcuts

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