Gbrowse/authentication plugins

Revision as of 17:13, 4 December 2012 by Lstein (Talk | contribs)

Jump to: navigation, search

GBrowse Authentication Plugins

To create your own authentication plugin, you need to create a .pm module which inherits from base "Bio::Graphics::Browser2::Plugin::AuthPlugin" and defines a minimum of two methods:

Given a username and credentials (e.g. a password), return true if the user has provided a valid combination. The username and password are ordinarily returned by calling the internal method credentials().
Given a user and a groupname, return true if the user belongs to the group.

Here is a simple example that uses hard-coded values:

 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','');

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