Punk-OAuth2

OAuth2 and OpenID Connect for the Punk web framework, both sides:

- the client (social login): "Log in with Google / GitHub / any OIDC
  provider" using the authorization-code flow with PKCE, signed
  single-use state, and id_token verification through Crypt::JWS;
- an authorization server and OpenID Provider (oauth2_server):
  authorization code + PKCE, refresh, client credentials and device
  authorization grants, id_tokens, UserInfo, RP-initiated logout,
  prompt/max_age/acr, pairwise subjects, dynamic registration;
- resource-server token checkers (Punk::OAuth2::Checker).

A runnable authorization server is in example/ (see example/README.md).

	package MyApp;
	use Punk;
	use Punk::Plugin::OAuth2;

	plugin 'OAuth2';
	session secret => secret('session_key'), expires => '7d';

	oauth2 google => {
		preset        => 'google',
		client_id     => secret('oauth.google_id'),
		client_secret => secret('oauth.google_secret'),
	};

	oauth2_login '/auth' => {
		on_login => 'Auth#on_login',
		base_url => 'https://app.example.com',
	};

The protocol logic on both sides runs in XS over the Crypt::JWS,
File::Raw::JSON, and Fetch C ABIs; the Perl layer is Punk registration
glue.

INSTALLATION

	perl Makefile.PL
	make
	make test
	make install

Requires Crypt::JWS, File::Raw::JSON, and Fetch (their C ABI headers at
build time), and Punk 0.17+. The shipped server store needs DBI and a DBD
(DBD::SQLite in the tests and the example), and the device grant's
attempt limit needs Hyperman (or a limiter of your own).

SUPPORT AND DOCUMENTATION

	perldoc Punk::OAuth2
	perldoc Punk::Plugin::OAuth2
	perldoc Punk::OAuth2::Server
	perldoc Punk::OAuth2::Checker

LICENSE AND COPYRIGHT

This software is Copyright (c) 2026 by LNATION <email@lnation.org>.

This is free software, licensed under:

	The Artistic License 2.0 (GPL Compatible)
