Documentation ¶
Index ¶
- Variables
- func AwsFilter(field string, op string, value string) *string
- func ContextWithJwt(ctx context.Context, token *jwt.Token) context.Context
- func GenerateRandomBytes(length int) []byte
- func GenerateRandomString(length int, charset []rune) string
- func GenerateUrlSafeRandomBytes(numBytes int) string
- func RandomAlphanumeric(length int) string
- func RandomHumanPassword() string
- func TokenFromHeader(r *http.Request) string
- func UserTypeFromAdminGetUserResult(res *cognitoidentityprovider.AdminGetUserOutput) types.UserType
- type AdminCreateUserOpt
- type CognitoAuth
- func (c *CognitoAuth) AdminCreateUser(ctx context.Context, email string, opt AdminCreateUserOpt) (*types.UserType, error)
- func (c *CognitoAuth) AdminGetUser(ctx context.Context, id string) (*cognitoidentityprovider.AdminGetUserOutput, error)
- func (c *CognitoAuth) AdminResendTemporaryPassword(ctx context.Context, email string) error
- func (c *CognitoAuth) AdminSetTemporaryPassword(ctx context.Context, id string) (string, error)
- func (c *CognitoAuth) Idp() *cognitoidentityprovider.Client
- func (c *CognitoAuth) ListUsers(ctx context.Context, input *cognitoidentityprovider.ListUsersInput) ([]types.UserType, error)
- func (c *CognitoAuth) PublicSettings() CognitoAuthPublicSettings
- func (c *CognitoAuth) UserPoolId() string
- type CognitoAuthPublicSettings
- type EntraAuth
- type EntraClaims
- type EntraPublicSettings
- type JwtAuth
- type JwtAuthOpt
- type NewEntraAuthInput
- type OidcConfig
- type UrlSigner
Constants ¶
This section is empty.
Variables ¶
View Source
var JwtCtxKey = &contextKey{"jwt"}
Functions ¶
func ContextWithJwt ¶ added in v0.13.6
func GenerateRandomBytes ¶ added in v0.0.6
func GenerateRandomString ¶
func GenerateUrlSafeRandomBytes ¶ added in v0.0.6
func RandomAlphanumeric ¶ added in v0.0.23
func RandomHumanPassword ¶
func RandomHumanPassword() string
func TokenFromHeader ¶
func UserTypeFromAdminGetUserResult ¶ added in v0.2.2
func UserTypeFromAdminGetUserResult(res *cognitoidentityprovider.AdminGetUserOutput) types.UserType
Types ¶
type AdminCreateUserOpt ¶
type AdminCreateUserOpt struct { Attributes []types.AttributeType TemporaryPassword string SuppressEmail bool }
type CognitoAuth ¶
type CognitoAuth struct {
// contains filtered or unexported fields
}
func NewCognitoAuth ¶
func NewCognitoAuthFromEnv ¶ added in v0.9.0
func NewCognitoAuthFromEnv( log zerolog.Logger, awsConfig aws.Config, ) *CognitoAuth
func (*CognitoAuth) AdminCreateUser ¶
func (c *CognitoAuth) AdminCreateUser(ctx context.Context, email string, opt AdminCreateUserOpt) (*types.UserType, error)
func (*CognitoAuth) AdminGetUser ¶
func (c *CognitoAuth) AdminGetUser(ctx context.Context, id string) (*cognitoidentityprovider.AdminGetUserOutput, error)
func (*CognitoAuth) AdminResendTemporaryPassword ¶
func (c *CognitoAuth) AdminResendTemporaryPassword(ctx context.Context, email string) error
func (*CognitoAuth) AdminSetTemporaryPassword ¶ added in v0.4.0
AdminSetTemporaryPassword sets the user's password to a temporary 'human' password. The user will need to set a password when they login.
func (*CognitoAuth) Idp ¶
func (c *CognitoAuth) Idp() *cognitoidentityprovider.Client
func (*CognitoAuth) ListUsers ¶ added in v0.2.2
func (c *CognitoAuth) ListUsers(ctx context.Context, input *cognitoidentityprovider.ListUsersInput) ([]types.UserType, error)
ListUsers with pagination handling. This is always important as cognito will sometimes return an empty page with a token.
func (*CognitoAuth) PublicSettings ¶ added in v0.0.14
func (c *CognitoAuth) PublicSettings() CognitoAuthPublicSettings
func (*CognitoAuth) UserPoolId ¶
func (c *CognitoAuth) UserPoolId() string
type CognitoAuthPublicSettings ¶ added in v0.0.14
type CognitoAuthPublicSettings struct { UserPoolId string `json:"UserPoolId"` ClientId string `json:"ClientId"` Region string `json:"Region"` }
CognitoAuthPublicSettings should precisely represent the 'UserPoolConfig' interface in ww-cognito-react.
type EntraAuth ¶ added in v0.15.0
type EntraAuth struct { *JwtAuth EntraPublicSettings }
func NewEntraAuth ¶ added in v0.15.0
func NewEntraAuth(ctx context.Context, input NewEntraAuthInput) (*EntraAuth, error)
type EntraClaims ¶ added in v0.14.7
type EntraClaims struct { Email string `json:"email"` Name string `json:"name"` Oid string `json:"oid"` Roles []string `json:"roles"` jwt.RegisteredClaims }
func (EntraClaims) HasRole ¶ added in v0.14.7
func (user EntraClaims) HasRole(role string) bool
func (EntraClaims) UserId ¶ added in v0.15.4
func (user EntraClaims) UserId() uuid.UUID
type EntraPublicSettings ¶ added in v0.15.0
type JwtAuth ¶ added in v0.14.0
type JwtAuth struct { JwtAuthOpt // contains filtered or unexported fields }
func NewJwtAuth ¶ added in v0.14.0
func NewJwtAuth(log zerolog.Logger, opt JwtAuthOpt) *JwtAuth
NewJwtAuth DANGER: It is very important for newClaims to return a fresh claims pointer, otherwise all requests will share the same JWT claims pointer!
func (*JwtAuth) JwtMiddleware ¶ added in v0.14.0
type JwtAuthOpt ¶ added in v0.14.0
type NewEntraAuthInput ¶ added in v0.15.0
type NewEntraAuthInput struct { Log zerolog.Logger EntraPublicSettings // Usually an API scope i.e. "api://<client-id>/my-api" Audience string // MSAL.js seems to use v1.0, v2.0 is supposed to be more standards compliant // [citation needed]. Version string }
type OidcConfig ¶ added in v0.14.7
OidcConfig i.e. https://login.microsoftonline.com/common/v2.0/.well-known/openid-configuration
type UrlSigner ¶ added in v0.2.1
type UrlSigner struct {
// contains filtered or unexported fields
}
func NewUrlSigner ¶ added in v0.2.1
func NewUrlSignerRandom ¶ added in v0.2.1
func NewUrlSignerRandom() *UrlSigner
func (*UrlSigner) SignUrlForTime ¶ added in v0.2.1
Click to show internal directories.
Click to hide internal directories.