Documentation ¶
Index ¶
- func SetTokenData(ctx context.Context, data *TokenContextData) context.Context
- type Client
- type ClientConfig
- type CustomClaims
- type JwtValidator
- type MockJwtValidator
- type MockJwtValidator_Expecter
- type MockJwtValidator_ValidateToken_Call
- func (_c *MockJwtValidator_ValidateToken_Call) Return(_a0 interface{}, _a1 error) *MockJwtValidator_ValidateToken_Call
- func (_c *MockJwtValidator_ValidateToken_Call) Run(run func(ctx context.Context, tokenString string)) *MockJwtValidator_ValidateToken_Call
- func (_c *MockJwtValidator_ValidateToken_Call) RunAndReturn(run func(context.Context, string) (interface{}, error)) *MockJwtValidator_ValidateToken_Call
- type TokenContextData
- type TokenContextKey
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SetTokenData ¶ added in v0.4.51
func SetTokenData(ctx context.Context, data *TokenContextData) context.Context
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func New ¶
func New( cfg *ClientConfig, ) (*Client, error)
type ClientConfig ¶
type ClientConfig struct { // Standard Issuer Url. Used for building the JWKS Provider BackendIssuerUrl string // Optionally provide a frontend Issuer Url. Falls back to BackendIssuerUrl if not provided. // This should be equivalent to what will be present in the "iss" claim of the JWT token. // This may be different depending auth provider or if running thorugh a reverse proxy FrontendIssuerUrl *string ApiAudiences []string SignatureAlgorithm validator.SignatureAlgorithm }
type CustomClaims ¶
type CustomClaims struct { Scope string `json:"scope"` Permissions []string `json:"permissions,omitempty"` Email *string `json:"email,omitempty"` }
CustomClaims contains custom data we want from the token.
type JwtValidator ¶
type MockJwtValidator ¶
MockJwtValidator is an autogenerated mock type for the JwtValidator type
func NewMockJwtValidator ¶
func NewMockJwtValidator(t interface { mock.TestingT Cleanup(func()) }) *MockJwtValidator
NewMockJwtValidator creates a new instance of MockJwtValidator. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.
func (*MockJwtValidator) EXPECT ¶
func (_m *MockJwtValidator) EXPECT() *MockJwtValidator_Expecter
func (*MockJwtValidator) ValidateToken ¶
func (_m *MockJwtValidator) ValidateToken(ctx context.Context, tokenString string) (interface{}, error)
ValidateToken provides a mock function with given fields: ctx, tokenString
type MockJwtValidator_Expecter ¶
type MockJwtValidator_Expecter struct {
// contains filtered or unexported fields
}
func (*MockJwtValidator_Expecter) ValidateToken ¶
func (_e *MockJwtValidator_Expecter) ValidateToken(ctx interface{}, tokenString interface{}) *MockJwtValidator_ValidateToken_Call
ValidateToken is a helper method to define mock.On call
- ctx context.Context
- tokenString string
type MockJwtValidator_ValidateToken_Call ¶
MockJwtValidator_ValidateToken_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ValidateToken'
func (*MockJwtValidator_ValidateToken_Call) Return ¶
func (_c *MockJwtValidator_ValidateToken_Call) Return(_a0 interface{}, _a1 error) *MockJwtValidator_ValidateToken_Call
func (*MockJwtValidator_ValidateToken_Call) Run ¶
func (_c *MockJwtValidator_ValidateToken_Call) Run(run func(ctx context.Context, tokenString string)) *MockJwtValidator_ValidateToken_Call
func (*MockJwtValidator_ValidateToken_Call) RunAndReturn ¶
func (_c *MockJwtValidator_ValidateToken_Call) RunAndReturn(run func(context.Context, string) (interface{}, error)) *MockJwtValidator_ValidateToken_Call
type TokenContextData ¶
type TokenContextData struct { ParsedToken *validator.ValidatedClaims RawToken string Claims *CustomClaims AuthUserId string Scopes []string // Contains Scopes & Permissions }
func GetTokenDataFromCtx ¶
func GetTokenDataFromCtx(ctx context.Context) (*TokenContextData, error)
func (*TokenContextData) HasScope ¶
func (t *TokenContextData) HasScope(scope string) bool
type TokenContextKey ¶
type TokenContextKey struct{}
Click to show internal directories.
Click to hide internal directories.