Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
istvankovacs-bitrise authored Nov 30, 2020
1 parent c8d1a7f commit 7191d8f
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@ You can use `ValidatorOption`s to configure.

- `ValidateRequest(r *http.Request) error` calls the `ValidateRequest` function of `auth0.JWTValidator` instance to validate a request. It returns `nil` if the validation has succeeded, otherwise returns an `error`.

- `ValidateRequestAndReturnToken(r *http.Request) (*TokenWithClaims, error)` calls the `ValidateRequest` function of `auth0.JWTValidator` instance to validate a request. It returns the validated `TokenWithClaims` token, that can be used to get the claims if the validation has succeeded, otherwise returns an `error`.

- `Middleware(next http.Handler, opts ...HTTPMiddlewareOption) http.Handler` returns an `http.Handler` instance. It calls `ValidateRequest` to validate the request. Calls the next middleware if the validation has succeeded, otherwise sends an error using an error writer. It might receive `HTTPMiddlewareOption`s as a parameter.

- `MiddlewareFunc(opts ...EchoMiddlewareOption) echo.MiddlewareFunc` returns an `echo.MiddlewareFunc` instance. It calls `ValidateRequest` to validate the request. Calls the next `echo.HandlerFunc` if the validation has succeeded, otherwise returns an `error`. It might receive `EchoMiddlewareOption`s as a parameter.
Expand All @@ -132,6 +134,16 @@ You can set the expceted audience via passing an `AudienceConfig` instance as a
service.NewValidator(config.NewAudienceConfig("audience1", "audience2"))
```

#### `TokenWithClaims`
Represents an UMA token that holds certain claims.

##### Methods
- `Payload() (map[string]interface{}, error)` returns the contents of the token.

- `Permissions() ([]interface{}, error)` returns the persmissions part of the token.

- `Claim(resourceName string, claim interface{}) error` returns the claim for the provided resource's name.


### Options
The package offers wide configurability using Options. You can easily override any parameter by passing the desired Option(s) as constructor arguments. Not only the `Validator` itself has Options, but each use-case has their own Options as well, offering further configuration possibilities.
Expand Down

0 comments on commit 7191d8f

Please sign in to comment.