Cataly...OpenID(3pm)

πŸ“¦
version 0.03+rp Β· 2 versions
  • 0.03+rp Β· debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking (latest)
  • 0.03+rp Β· ubuntu jammy
, in debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking

πŸ’– Cataly...OpenID β€” the vibe πŸ’–

okay bestie, so this is a page from the User Contributed Perl Documentation section, and it lives under the manual name Cataly...OpenID (in the <pink>3pm</pink> zone, aka Perl module docs, iykyk). sit down, grab a strawberry, we're learning OpenID auth in Catalyst and honestly? it's giving iconic. πŸ“βœ¨


✨ NAME ✨

Catalyst::Plugin::Authentication::Credential::OpenID β€” an OpenID credential for the Catalyst::Auth framework. that's it, that's the whole name section. short queen. πŸ’…


🌸 SYNOPSIS 🌸

here's the setup, bestie. load these plugins:

use Catalyst qw/
  Authentication
  Authentication::Credential::OpenID
  Session
  Session::Store::FastMmap
  Session::State::Cookie
/;

then optionally, in your MyApp.yaml, you can drop this config:

# MyApp.yaml -- optional
authentication:
  openid:
    use_session: 1
    user_class: MyApp::M::User::OpenID

then whatever you want in your Controller pm:

sub default : Private {
    my($self, $c) = @_;
    if ($c->user_exists) { ... }
}

sub signin_openid : Local {
    my($self, $c) = @_;

    if ($c->authenticate_openid) {
        $c->res->redirect( $c->uri_for('/') );
    }
}

and the form, in foo.tt:

<form action="[% c.uri_for('/signin_openid') %]" method="GET">
<input type="text" name="openid_url" class="openid" />
<input type="submit" value="Sign in with OpenID" />
</form>

look at that. a whole login flow. we ate. πŸ”₯


πŸ¦‹ DESCRIPTION πŸ¦‹

Catalyst::Plugin::Authentication::Credential::OpenID is literally an OpenID credential for the Catalyst::Plugin::Authentication framework. that's the assignment. main character energy only. πŸ‘‘


πŸ’… METHODS πŸ’…

authenticate_openid πŸ’–

$c->authenticate_openid;

call this method in the action where you wanna authenticate your user via OpenID, bestie. it returns 0 if the auth did NOT pop off, and 1 if the user is authenticated. periodt.

the user class you specified with the user_class config β€” which defaults to Catalyst::Plugin::Authentication::User::Hash β€” gets instantiated with the following parameters:

  • url
  • display
  • rss
  • atom
  • foaf
  • declared_rss
  • declared_atom
  • declared_foaf
  • foafmaker

see Net::OpenID::VerifiedIdentity for the deets, bestie. πŸ‘€

ngl, by default the authenticate_openid method goes looking for the claimed URI parameter from the form field named "openid_url", "openid_identifier" or "claimed_uri". want a different form field name? say less, call it like this:

$c->authenticate_openid( $c->req->param('myopenid_param') );

custom param name, custom slay. ✨


πŸ’€ DIFFERENCE WITH Authentication::OpenID πŸ’€

okay so there's ALREADY a Catalyst::Plugin::Authentication::OpenID (aka Auth::OpenID), and this plugin is lowkey trying to deprecate it. the way that this is a glow-up, not a copy. πŸ’…

  • Don't use this plugin with Auth::OpenID since the method names will conflict and your app won't work. no cap, do not do it. πŸ™ˆ
  • Auth::OpenID uses your root path (/) as an authentication callback, but this plugin uses the current path, which means you can use this plugin with other Credential plugins, like Flickr or TypeKey. flexible queen. 🌈
  • this plugin is NOT a drop-in replacement for Auth::OpenID, but your app needs only slight modifications to work with this one. tiny little tweaks, no biggie. πŸŽ€
  • this plugin is based on the Catalyst authentication framework, which means you can specify user_class or auth_store in your app config and this module does the right thing, like other Credential modules. it crates a new User object if authentication is successful, and it works with Session too. obsessed. ✨

🫢 AUTHOR 🫢

Six Apart, Ltd. <cpan@sixapart.com> β€” the icons who made this. πŸ’œ


πŸ“œ LICENSE πŸ“œ

this library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. slay, legally. βš–οΈβœ¨


πŸ‘€ SEE ALSO πŸ‘€

go read these next, bestie, they're the whole friend group:

  • Catalyst::Plugin::Authentication::OpenID
  • Catalyst::Plugin::Authentication::Credential::Flickr

and that's the whole page, babe πŸŽ€ this lil doc came to you from perl v5.34.0, dated 2022-06-09, and the manual name up top is Cataly...OpenID(3pm) β€” go forth and authenticate, you're gonna do amazing, fr fr. πŸ’–πŸ¦‹πŸ’…

πŸ“¦ where this page comes from