Documentation
¶
Index ¶
- Constants
- func GetJwtToken(ctx context.Context) string
- func ParseExpires(ExpiresHeaderStr string) (int64, error)
- func ParseMaxAge(CacheControlHeaderStr string) (int64, error)
- type AuthMeta
- func (a *AuthMeta) AttachAuthorizationJwt(ctx context.Context, header http.Header) (context.Context, error)
- func (a *AuthMeta) ExtractCustomClaims(ctx context.Context) (*CustomClaims, error)
- func (a *AuthMeta) FetchJWK(i int) error
- func (a *AuthMeta) FetchJWKs() error
- func (a *AuthMeta) GetHeader() string
- func (a *AuthMeta) InitHttpClient()
- type CustomClaims
Constants ¶
View Source
const ( AuthJwtCtxKey = ctxKey("authorizationJwt") AuthMetaHeader = "Dgraph.Authorization" )
Variables ¶
This section is empty.
Functions ¶
func GetJwtToken ¶
func ParseExpires ¶
func ParseMaxAge ¶
Types ¶
type AuthMeta ¶
type AuthMeta struct { VerificationKey string JWKUrl string JWKUrls []string RSAPublicKey *rsa.PublicKey `json:"-"` // Ignoring this field Header string Namespace string Algo string SigningMethod jwt.SigningMethod `json:"-"` // Ignoring this field Audience []string ClosedByDefault bool // contains filtered or unexported fields }
func ParseAuthMeta ¶
func (*AuthMeta) AttachAuthorizationJwt ¶
func (a *AuthMeta) AttachAuthorizationJwt(ctx context.Context, header http.Header) (context.Context, error)
AttachAuthorizationJwt adds any incoming JWT authorization data into the grpc context metadata.
func (*AuthMeta) ExtractCustomClaims ¶
func (a *AuthMeta) ExtractCustomClaims(ctx context.Context) (*CustomClaims, error)
func (*AuthMeta) FetchJWKs ¶
FetchJWKs fetches the JSON Web Key sets for the JWKUrls. It returns an error if the fetching of key is failed even for one of the JWKUrl.
func (*AuthMeta) InitHttpClient ¶
func (a *AuthMeta) InitHttpClient()
type CustomClaims ¶
type CustomClaims struct { AuthVariables map[string]interface{} jwt.RegisteredClaims // contains filtered or unexported fields }
func (*CustomClaims) UnmarshalJSON ¶
func (c *CustomClaims) UnmarshalJSON(data []byte) error
UnmarshalJSON unmarshalls the claims present in the JWT. It also adds standard claims to the `AuthVariables`. If there is an auth variable with name same as one of auth variable then the auth variable supersedes the standard claim.
Click to show internal directories.
Click to hide internal directories.