Documentation ¶
Overview ¶
Package token provides policy wrappers / getters for queries and mutations during password reset, signup
Index ¶
- Variables
- func NewContextWithOauthTooToken(parent context.Context, email string) context.Context
- func NewContextWithOrgInviteToken(parent context.Context, orgInviteToken string) context.Context
- func NewContextWithResetToken(parent context.Context, resetToken string) context.Context
- func NewContextWithSignUpToken(parent context.Context, email string) context.Context
- func NewContextWithVerifyToken(parent context.Context, verifyToken string) context.Context
- type OauthTooToken
- type OrgInviteToken
- type PrivacyToken
- type ResetToken
- type SignUpToken
- type VerifyToken
Constants ¶
This section is empty.
Variables ¶
var ( ErrIncorrectEmail = errors.New("privacy token has incorrect email") ErrInvalidTokenType = errors.New("invalid token type") )
Functions ¶
func NewContextWithOauthTooToken ¶ added in v0.3.0
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
NewContextWithOrgInviteToken returns a new context with the reset token inside
func NewContextWithResetToken ¶
NewContextWithResetToken returns a new context with the reset token inside
func NewContextWithSignUpToken ¶
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
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) 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