oauth2

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2022 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	JWTKey = "openapi_oauth2_token_secret"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type JWTAccessClaims

type JWTAccessClaims struct {
	jwt.StandardClaims
	Payload apistructs.OpenapiOAuth2TokenPayload `json:"payload"`
}

JWTAccessClaims jwt claims

func ParseJWTAccess

func ParseJWTAccess(access string) (*JWTAccessClaims, error)

func (*JWTAccessClaims) Valid

func (a *JWTAccessClaims) Valid() error

Valid claims verification

type JWTAccessGenerate

type JWTAccessGenerate struct {
	SignedKey    []byte
	SignedMethod jwt.SigningMethod
}

JWTAccessGenerate generate the jwt access token

func NewJWTAccessGenerate

func NewJWTAccessGenerate(key []byte, method jwt.SigningMethod) *JWTAccessGenerate

NewJWTAccessGenerate create to generate the jwt access token instance

func (*JWTAccessGenerate) Token

func (a *JWTAccessGenerate) Token(data *oauth2.GenerateBasic, isGenRefresh bool) (string, string, error)

Token based on the UUID generated token

type OAuth2Server

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

func NewOAuth2Server

func NewOAuth2Server() *OAuth2Server

func (*OAuth2Server) InvalidateToken

func (o *OAuth2Server) InvalidateToken(w http.ResponseWriter, r *http.Request)

{{openapi}}/oauth2/invalidate_token?access_token=xxx

func (*OAuth2Server) Server

func (o *OAuth2Server) Server() *server.Server

func (*OAuth2Server) Token

func (o *OAuth2Server) Token(w http.ResponseWriter, r *http.Request)

{{openapi}}/oauth2/token?grant_type=client_credentials&client_id=pipeline&client_secret=devops/pipeline&scope=read

func (*OAuth2Server) ValidateToken

func (o *OAuth2Server) ValidateToken(w http.ResponseWriter, r *http.Request)

{{openapi}}/oauth2/validate_token?access_token=xxx

Directories

Path Synopsis
clientstore
tokenstore

Jump to

Keyboard shortcuts

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