NAME
WebService::Hydra::Client - Hydra Client Object
Description
Object::Pad based class which is used to create a Hydra Client Object which interacts with the Hydra service API.
SYNOPSIS
use WebService::Hydra::Client;
my $obj = WebService::Hydra::Client->new(admin_endpoint => 'url' , public_endpoint => 'url');
METHODS
new
admin_endpoint
-
admin_endpoint is a string which contains admin URL for the hydra service. Eg: http://localhost:4445 This is a required parameter when creating Hydra Client Object using new.
public_endpoint
-
public_endpoint is a string which contains the public URL for the hydra service. Eg: http://localhost:4444 This is a required parameter when creating Hydra Client Object using new.
admin_endpoint
Returns the base URL for the hydra service.
public_endpoint
Returns the base URL for the hydra service.
http
Return HTTP object.
jwks return jwks object
oidc_config
returns an object with oidc configuration
api_call
Takes request method, the endpoint, and the payload. It sends the request to the Hydra service, parses the response and returns:
1. JSON object of code and data returned from the service. 2. Error string in case an exception is thrown.
get_login_request
Fetches the OAuth2 login request from hydra.
Arguments:
$login_challenge
-
Authentication challenge string that is used to identify and fetch information about the OAuth2 request from hydra.
accept_login_request
Accepts the login request and returns the response from hydra.
Arguments:
$login_challenge
-
Authentication challenge string that is used to identify the login request.
$accept_payload
-
Payload to be sent to the Hydra service to confirm the login challenge.
get_logout_request
Get the logout request and return the response from Hydra.
accept_logout_request
The response contains a redirect URL which the logout provider should redirect the user-agent to.
exchange_token
Exchanges the authorization code with Hydra service for access and ID tokens.
fetch_jwks
Fetches the JSON Web Key Set published by Hydra which is used to validate signatures.
fetch_openid_configuration
Fetches the openid-configuration from hydra
validate_id_token
Decodes the id_token and validates its signature against Hydra and returns the decoded payload.
validate_token
Decodes the token and validates its signature against hydra and returns the decoded payload.
Returns the decoded payload if the token is valid, otherwise throws an exception.
get_consent_request
Fetches the consent request from Hydra.
accept_consent_request
Accepts the consent request and returns the response from Hydra.
revoke_login_sessions
This endpoint invalidates authentication sessions. It expects a user ID (subject) and invalidates all sessions for this user. or session ID (sid) and invalidates the session.