oauth2

package module
v0.0.0-...-d7df67f Latest Latest
Warning

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

Go to latest
Published: May 21, 2019 License: Apache-2.0 Imports: 11 Imported by: 1

README

fosite-gcp-oauth2

GCP Strategy for ory/fosite utilizing IAM API to sign tokens

TODO

  • make tests

  • write HOW TO USE

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IAMStrategy

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

IAMStrategy is responsible for generating and validating JWT challenges and implements JWTStrategy using the IAM API.

func NewIAMStrategy

func NewIAMStrategy(ctx context.Context, sm *gcpjwt.SigningMethodIAM, config *gcpjwt.IAMConfig) *IAMStrategy

NewIAMStrategy will return a fosite/token/jwt.JWTStrategy compatible object configured for the IAM signing method provided

func (IAMStrategy) Decode

func (g IAMStrategy) Decode(ctx context.Context, token string) (*jwt.Token, error)

Decode will decode a JWT token

func (IAMStrategy) Generate

func (g IAMStrategy) Generate(ctx context.Context, claims jwt.Claims, header fjwt.Mapper) (string, string, error)

Generate generates a new authorize code or returns an error. set secret

func (*IAMStrategy) GetPublicKeyID

func (i *IAMStrategy) GetPublicKeyID(_ context.Context) (string, error)

func (IAMStrategy) GetSignature

func (g IAMStrategy) GetSignature(_ context.Context, token string) (string, error)

GetSignature will return the signature of a token

func (IAMStrategy) GetSigningMethodLength

func (g IAMStrategy) GetSigningMethodLength() int

GetSigningMethodLength will return the length of the signing method

func (IAMStrategy) Hash

func (g IAMStrategy) Hash(_ context.Context, in []byte) ([]byte, error)

Hash will return a given hash based on the byte input or an error upon fail

func (IAMStrategy) Validate

func (g IAMStrategy) Validate(ctx context.Context, token string) (string, error)

Validate validates a token and returns its signature or an error if the token is not valid.

type KMSStrategy

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

KMSStrategy is responsible for generating and validating JWT challenges and implements JWTStrategy using Cloud KMS.

func NewKMSStrategy

func NewKMSStrategy(ctx context.Context, sm *gcpjwt.SigningMethodKMS, config *gcpjwt.KMSConfig) (*KMSStrategy, error)

NewKMSStrategy will return a fosite/token/jwt.JWTStrategy compatible object configured for the Cloud KMS signing method provided

func (KMSStrategy) Decode

func (g KMSStrategy) Decode(ctx context.Context, token string) (*jwt.Token, error)

Decode will decode a JWT token

func (KMSStrategy) Generate

func (g KMSStrategy) Generate(ctx context.Context, claims jwt.Claims, header fjwt.Mapper) (string, string, error)

Generate generates a new authorize code or returns an error. set secret

func (*KMSStrategy) GetPublicKeyID

func (k *KMSStrategy) GetPublicKeyID(_ context.Context) (string, error)

func (KMSStrategy) GetSignature

func (g KMSStrategy) GetSignature(_ context.Context, token string) (string, error)

GetSignature will return the signature of a token

func (KMSStrategy) GetSigningMethodLength

func (g KMSStrategy) GetSigningMethodLength() int

GetSigningMethodLength will return the length of the signing method

func (KMSStrategy) Hash

func (g KMSStrategy) Hash(_ context.Context, in []byte) ([]byte, error)

Hash will return a given hash based on the byte input or an error upon fail

func (KMSStrategy) Validate

func (g KMSStrategy) Validate(ctx context.Context, token string) (string, error)

Validate validates a token and returns its signature or an error if the token is not valid.

type OAuth2JWTStrategy

type OAuth2JWTStrategy struct {
	oauth2.DefaultJWTStrategy
	// contains filtered or unexported fields
}

func NewOAuth2GCPStrategy

func NewOAuth2GCPStrategy(ctx context.Context, corestrat jwk.JWTStrategy, strategy *oauth2.HMACSHAStrategy) *OAuth2JWTStrategy

NewOAuth2GCPStrategy returns a strategy leveraging the provided jwk.JWTStrategy for making JWT Access Tokens

func (*OAuth2JWTStrategy) GetPublicKeyID

func (j *OAuth2JWTStrategy) GetPublicKeyID(ctx context.Context) (string, error)

GetPublicKeyID returns a blank string as GCP manages/rotates this on its own and auto injects it into the signed JWT header.

type OIDCJWTStrategy

type OIDCJWTStrategy struct {
	openid.DefaultStrategy
	// contains filtered or unexported fields
}

func NewOpenIDConnectStrategy

func NewOpenIDConnectStrategy(ctx context.Context, corestrat jwk.JWTStrategy) *OIDCJWTStrategy

NewOpenIDConnectStrategy returns a strategy leveraging the provided jwk.JWTStrategy for making JWT Access Tokens

func (*OIDCJWTStrategy) GetPublicKeyID

func (j *OIDCJWTStrategy) GetPublicKeyID(ctx context.Context) (string, error)

GetPublicKeyID returns a blank string as GCP manages/rotates this on its own and auto injects it into the signed JWT header.

Jump to

Keyboard shortcuts

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