Bio::G...hPlugin(3pm)

πŸ“¦
version 2.56 Β· 5 versions
, in ubuntu questing

πŸ’– Bio::G...hPlugin(3pm) πŸ’–

okay so bestie, you just opened a page from the User Contributed Perl Documentation manual, and the page is called Bio::G...hPlugin(3pm). the actual thing it documents is Bio::Graphics::Browser2::Plugin::AuthPlugin. buckle up, it's giving ✨auth infrastructure✨.


🌸 NAME 🌸

Bio::Graphics::Browser2::Plugin::AuthPlugin β€” the base class for authentication plugins. it's the blueprint all the other auth plugins inherit their whole vibe from. periodt. πŸ’…


✨ SYNOPSIS ✨

package Bio::Graphics::Browser2::Plugin::MyPlugin;
use base 'Bio::Graphics::Browser2::Plugin::AuthPlugin';

sub authenticate {
    my $self = shift;
    my ($user,$password) = $self->credentials;
    return unless  $user eq 'george' && $password eq 'washington';
    return ($user,'George Washington','george@whitehouse.gov');
}

sub user_in_group {
    my $self = shift;
    my ($user,$group) = @_;
    return $user eq 'george' && $group eq 'potomac';
}

not george washington being in the potomac group 😭 iconic honestly. copy this, swap the names, you're basically done.


πŸ¦‹ DESCRIPTION πŸ¦‹

This right here is the template for authorizer plugins. To define a brand new type of authorizer, you literally only need to inherit from this class and define an authenticate() method. That method takes two arguments: the username and the password. It returns an empty list if authentication fails, or a list of (username, fullname, email) if authentication succeeds. heads up: fullname and email are optional, so don't stress about them. 🫢

On top of that, you may override the user_in_group() method. It takes two arguments: the username and the group. Return true if the user belongs to the group, and false otherwise. simple. no cap.

Other methods you might wanna override include:

  • authentication_hint()
  • authentication_help()
  • configure_form()
  • reconfigure()
  • credentials()

these are all described below πŸ‘‡ iykyk.


πŸ’… Methods you will need to override πŸ’…

girl these are NOT optional. these are the whole assignment.
  • $boolean = $plugin->authenticate($username,$password) β€” Return true if username and password are correct. False otherwise.
  • $boolean = $plugin->user_in_group($username,$groupname) β€” Return true if user belongs to group. False otherwise.

πŸŽ€ Methods that you may want to customize πŸŽ€

  • $message = $plugin->authentication_hint β€” Returns a message printed at the top of the login dialog, that will help the user know which credentials he is expected to present. For example, returning "Acme Corp Single Sign-on" will present the user with "Please log into your Acme Corp Single Sign-on". The default behavior is to take this value from the "login hint" option in a stanza named [AuthPlugin:plugin]. Example:
  • $message = $plugin->authentication_help β€” Returns a message printed at the bottom of the login dialog. It is expected to be used for a help message or link that will give the user help with logging in. For example, it can take him to a link to reset his password. The default behavior is to take this value from the "login help" option in a stanza named [AuthPlugin:plugin].
[AuthPlugin:plugin]
login hint = your Acme Corp Single Sign-on Account
login help = <a href="www.acme.com/passwd_help">Recover forgotten password</a>

πŸ‘‘ Methods that you may want to override πŸ‘‘

  • $html = $plugin->configure_form() β€” This method returns the contents of the login form. The default behavior is to produce two text fields, one named 'name' and the other named 'password'. very demure, very mindful.
  • $plugin->reconfigure() β€” This method is called to copy the values from the filled-out form into the plugin's hash of configuration variables. ⚠️ if you add fields to configure_form() you will need to adjust this method as well. don't forget, bestie.
  • $plugin->config_defaults() β€” Set up defaults for the configuration hash. Use this if you wish to default to a particular username.
  • $plugin->credentials() β€” This returns a two-element list containing the username and password last entered into the authentication dialog. It reads these values from the configuration hash returned by $self->configuration(). If you add additional types of credentials to the login dialog, you may need to override this method.

🌈 SEE ALSO 🌈

Bio::Graphics::Browser2


πŸ’œ AUTHOR πŸ’œ

Lincoln Stein lincoln.stein@gmail.com<gt>.

Copyright (c) 2011 Ontario Institute for Cancer Research

This package and its accompanying libraries is free software; you can redistribute it and/or modify it under the terms of the GPL (either version 1, or at your option, any later version) or the Artistic License 2.0. Refer to LICENSE for the full license text. In addition, please see DISCLAIMER.txt for disclaimers of warranty.


okay that's the whole page, you made it to the end πŸŽ‰ this was perl v5.40.0, dated 2024-10-20, from the Bio::G...hPlugin(3pm) page β€” now go forth and write an auth plugin that eats. πŸ’–βœ¨πŸ‘‘

πŸ“¦ where this page comes from