oauth

package
v0.0.0-...-0001d10 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2020 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GOOGLE_ID_TOKEN_KEY string = "X-GOOGLE-ID-TOKEN"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type GoogleIDTokenVerifier

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

func NewGoogleIDTokenVerifier

func NewGoogleIDTokenVerifier() *GoogleIDTokenVerifier

func (*GoogleIDTokenVerifier) Verify

func (g *GoogleIDTokenVerifier) Verify(ctx context.Context, rawIDToken string) (IDToken, error)

type GoogleOauth

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

func NewGoogleOauth

func NewGoogleOauth(verifier IDTokenVerifier) GoogleOauth

func (GoogleOauth) Authenticate

func (g GoogleOauth) Authenticate(req *http.Request) (*http.Request, error)

Authenticates the user using the ID Token received from Google.

func (GoogleOauth) Name

func (g GoogleOauth) Name() string

func (GoogleOauth) SetLogger

func (g GoogleOauth) SetLogger(l log.Logger)

func (GoogleOauth) Stats

func (g GoogleOauth) Stats() stats.Metrics

func (GoogleOauth) Verify

func (GoogleOauth) Verify(ctx context.Context, data auth.AuthRequest) error

Verify the provided AAD in the transaction data with the expected AAD Transaction data is expected to be in the following format:

pk || cipher length || aad length || cipher || aad || nonce
- pk is expected to be 16 bytes
- cipher length and aad length are uint64 encoded in big endian
- nonce is expected to be 5 bytes

type IDToken

type IDToken interface {
	Claims(v interface{}) error
}

type IDTokenVerifier

type IDTokenVerifier interface {
	Verify(ctx context.Context, rawIDToken string) (IDToken, error)
}

type OpenIDClaims

type OpenIDClaims struct {
	Email         string `json:"email"`
	EmailVerified bool   `json:"email_verified"`
}

Jump to

Keyboard shortcuts

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