oidc

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2021 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const AuthorisationCode = "authorization_code"
View Source
const ClientCredentials = "client_credentials"
View Source
const PKCE = "PKCE"
View Source
const WellKnownPath = "/.well-known/openid-configuration"

Variables

This section is empty.

Functions

func AbsoluteExpiry

func AbsoluteExpiry(now time.Time, expiresIn int) int64

func AssertAvailablePRNG

func AssertAvailablePRNG() error

func BuildCodeAuthorisationRequest

func BuildCodeAuthorisationRequest(configuration WellKnownConfiguration, clientId string, redirectUri string, scopes []string, state string, codeChallenge string) string

func FormPost

func FormPost(tokenEndpoint string, clientId string, clientSecret string, formData url.Values, result interface{}) error

func GenerateBase64Sha256Hash

func GenerateBase64Sha256Hash(input string) string

func GeneratePkceString

func GeneratePkceString(n int) (string, error)

func GenerateRandomBytes

func GenerateRandomBytes(n int) ([]byte, error)

func GenerateRandomStringURLSafe

func GenerateRandomStringURLSafe(n int) (string, error)

func GetRandomNumberBetween

func GetRandomNumberBetween(min int, max int) (int, error)

func GetSchemeAndHost

func GetSchemeAndHost(urlString string) (string, error)

func ValidateToken

func ValidateToken(tokenString string, configuration WellKnownConfiguration, clientId string) (interface{}, error)

Types

type AccessTokenResultSet

type AccessTokenResultSet struct {
	AccessToken string `json:"access_token"`
	TokenType   string `json:"token_type"`
	ExpiresIn   int    `json:"expires_in"`
	ExpiresAt   int64  `json:"expires_at"`
}

func RequestWithClientCredentials

func RequestWithClientCredentials(tokenEndpoint string, clientId string, clientSecret string, scope string) (AccessTokenResultSet, error)

type AuthorisationResponse

type AuthorisationResponse struct {
	Code  string
	State string
}

func ValidateAuthorisationResponse

func ValidateAuthorisationResponse(url *url.URL, state string) (AuthorisationResponse, error)

type CodeVerifier

type CodeVerifier struct {
	CodeVerifier  string
	CodeChallenge string
}

func GenerateCodeVerifier

func GenerateCodeVerifier() (CodeVerifier, error)

type RefreshResult

type RefreshResult struct {
	RefreshToken string `json:"refresh_token"`
	AccessToken  string `json:"access_token"`
	ExpiresIn    int    `json:"expires_in"`
	TokenType    string `json:"token_type"`
}

func RefreshToken

func RefreshToken(authority string, clientId string, clientSecret string, refreshToken string) (RefreshResult, error)

type TokenResultSet

type TokenResultSet struct {
	AccessToken   string `json:"access_token"`
	IdentityToken string `json:"id_token"`
	RefreshToken  string `json:"refresh_token"`
	TokenType     string `json:"token_type"`
	ExpiresIn     int    `json:"expires_in"`
	ExpiresAt     int64  `json:"expires_at"`
}

func ExchangeCodeForToken

func ExchangeCodeForToken(tokenEndpoint string, code string, clientId string, clientSecret string, codeVerifier string, redirectUri string) (TokenResultSet, error)

type WellKnownConfiguration

type WellKnownConfiguration struct {
	AuthorisationEndpoint string `json:"authorization_endpoint"`
	TokenEndpoint         string `json:"token_endpoint"`
	JwksUri               string `json:"jwks_uri"`
	Issuer                string `json:"issuer"`
}

func GetMetadata

func GetMetadata(authority string) (WellKnownConfiguration, error)

Jump to

Keyboard shortcuts

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