View Source oidcc_cowboy_validate_jwt_token (oidcc_cowboy v2.0.0-rc.1)
Validate extracted authorization token by validating it as a JWT token.
This middleware should be used together with oidcc_cowboy_extract_authorization
.
Usage
OidccCowboyOpts = #{
provider => openid_confi_provider_name,
client_id => <<"client_id">>,
client_secret => <<"client_secret">>
},
Dispatch = cowboy_router:compile([
{'_', [
%% ...
]}
]),
{ok, _} = cowboy:start_clear(http, [{port, 8080}], #{
middlewares => [
oidcc_cowboy_extract_authorization,
oidcc_cowboy_validate_jwt_token,
cowboy_router,
cowboy_handler
],
env => #{
dispatch => Dispatch,
oidcc_cowboy_validate_jwt_token => OidccCowboyOpts
}
})
Summary
Types
Link to this type
opts/0
View Source (since 2.0.0 -------------------------------------------------------------------)-type opts() :: #{provider := gen_server:server_ref(), client_id := binary(), client_secret := binary(), send_inactive_token_response => fun((Req :: cowboy_req:req(), Env :: cowboy_middleware:env()) -> {ok, cowboy_req:req(), cowboy_middleware:env()} | {stop, cowboy_req:req()})}.
Options for the middleware
Options
provider
- name of theoidcc_provider_configuration_worker
client_id
- OAuth Client ID to use for the token validationclient_secret
- OAuth Client Secret to use for the token validationsend_inactive_token_response
- Customize Error Response for inactive token