NAME
WWW::Keycloak::Role::HTTP - Sending requests to Keycloak and turning failures into exceptions
VERSION
version 0.001
DESCRIPTION
What WWW::Keycloak::Admin, WWW::Keycloak::OIDC and WWW::Keycloak::Auth share: one LWP::UserAgent, JSON in and out, and the mapping of Keycloak's three error shapes onto WWW::Keycloak::Error::API.
api_error_class
network_error_class
The classes the errors are thrown as. Net::Async::Keycloak overrides them with its own subclasses.
build_request
my $request = $self->build_request( POST => $url, json => \%body, bearer => $token );
my $request = $self->build_request( POST => $url, form => \%fields );
The HTTP::Request for one call: JSON accepted, a bearer token when given, the body as JSON or as a form.
read_response
my $result = $self->read_response( $response, $method, $url, %arg );
Turns an HTTP::Response into status, the decoded data and the location header, or throws "api_error_class" for any status of 400 and above. %arg are the arguments the request was built with.
send_request
my $result = $self->send_request( POST => $url, json => \%body, bearer => $token );
my $result = $self->send_request( POST => $url, form => \%fields );
Sends one request. Returns status, the decoded data and the location header. Throws WWW::Keycloak::Error::Network when no answer came back and WWW::Keycloak::Error::API for any status of 400 and above.
SUPPORT
Issues
Please report bugs and feature requests on GitHub at https://github.com/Getty/p5-www-keycloak/issues.
IRC
Join #kubernetes on irc.perl.org or message Getty directly.
CONTRIBUTING
Contributions are welcome! Please fork the repository and submit a pull request.
AUTHOR
Torsten Raudssus <getty@cpan.org>
COPYRIGHT AND LICENSE
This software is copyright (c) 2026 by Torsten Raudssus <torsten@raudssus.de> https://raudssus.de/.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.