view release on metacpan or search on metacpan
script/auth_bootstrap.pl view on Meta::CPAN
help => \$help);
pod2usage(1) if ( $help || !$credential );
if ($credential !~ /^(http|password)$/) {
die "Valid credentials are 'http' for basic auth or 'password' for web based auth";
}
Catalyst::Helper::AuthDBIC::make_model();
Catalyst::Helper::AuthDBIC::mk_auth_controller() if $credential eq 'password';
Catalyst::Helper::AuthDBIC::add_plugins();
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Catalyst/Manual/Components.pod view on Meta::CPAN
config hash. Great for testing or getting up and running quickly.
=head4 L<Catalyst::Authentication::Store::Null>
The Null store is a transparent store where any supplied user data is
accepted. This is mainly useful for remotely authenticating credentials
(e.g. OpenID) which may not be tied to any local storage.
=head4 L<Catalyst::Authentication::Store::RDBO>
Allows access to authentication information stored in a database via a L<Rose::DB::Object> class.
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Catalyst/Model/LDAP/Connection.pm view on Meta::CPAN
On connection failure, an error is thrown using L<Carp/croak>.
=head2 bind
Bind to the configured LDAP server using the specified credentials.
$conn->bind(
dn => 'uid=dwc,ou=People,dc=ufl,dc=edu',
password => 'secret',
);
view all matches for this distribution
view release on metacpan or search on metacpan
inc/Test/WWW/Mechanize/Catalyst.pm view on Meta::CPAN
}
my $res = $self->_check_external_request($request);
return $res if $res;
my @creds = $self->get_basic_credentials( "Basic", $uri );
$request->authorization_basic( @creds ) if @creds;
my $response =Catalyst::Test::local_request($self->{catalyst_app}, $request);
# LWP would normally do this, but we dont get down that far.
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Catalyst/Model/SCP.pm view on Meta::CPAN
=head1 SUBROUTINES/METHODS
=head2 is_connection_success
C<is_connection_success()> - Returns true when it able to make connection using specified credentials.
=cut
has is_connection_success => (
isa => 'Bool',
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Catalyst/Plugin/Authentication/Credential/Atom.pm view on Meta::CPAN
use constant NS_WSSE => 'http://schemas.xmlsoap.org/ws/2002/07/secext';
use constant NS_WSU => 'http://schemas.xmlsoap.org/ws/2002/07/utility';
sub login_atom {
my $c = shift;
my($username, $cred) = $c->_extract_credentials;
unless ($username) {
return $c->_atom_auth_error(401);
}
if (my $user = $c->get_user($username)) {
if ($c->_validate_credentials($user, $cred)) {
$c->set_authenticated($user);
return $username;
}
}
return $c->_atom_auth_error(403);
lib/Catalyst/Plugin/Authentication/Credential/Atom.pm view on Meta::CPAN
$c->response->header('WWW-Authenticate',
'WSSE profile="UsernameToken", Basic');
return 0;
}
sub _extract_credentials {
my $c = shift;
my $req = $c->request;
my($tokens, $username, %cred);
## SOAP wrapper only supports WSSE?
if ($req->is_soap) {
lib/Catalyst/Plugin/Authentication/Credential/Atom.pm view on Meta::CPAN
$username = delete $cred{Username};
}
($username, \%cred);
}
sub _validate_credentials {
my $c = shift;
my($user, $cred) = @_;
if ($cred->{password}) {
return $c->_check_password($user, $cred->{password})
} elsif ($cred->{PasswordDigest}) {
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Catalyst/Plugin/Authentication/Credential/HTTP/Proxy.pm view on Meta::CPAN
croak "url setting required for authentication"
unless $c->config->{authentication}{http_proxy}{url};
if ( my ( $user, $password ) = $headers->authorization_basic ) {
my $ua=Catalyst::Plugin::Authentication::Credential::HTTP::User->new;
$ua->credentials($user,$password);
my $resp= $ua->get($c->config->{authentication}{http_proxy}{url});
if ( $resp->is_success ) {
if ( my $store = $c->config->{authentication}{http_proxy}{store} ) {
$user = $store->get_user($user);
} elsif ( my $user_obj = $c->get_user($user) ) {
lib/Catalyst/Plugin/Authentication/Credential/HTTP/Proxy.pm view on Meta::CPAN
} elsif ( $c->debug ) {
$c->log->info('Remote authentication failed:'.$resp->message);
return 0;
}
} elsif ( $c->debug ) {
$c->log->info('No credentials provided for basic auth');
return 0;
}
}
sub authorization_required {
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Catalyst/Plugin/Authentication/Credential/TypeKey.pm view on Meta::CPAN
my %ret;
if ( @params % 2 == 1 ) {
# either it's a user object or a hash ref of credentials
# if it's a user object the credentials are pulled out of it
# otherwise a user will be found/made for the credentials
if ( Scalar::Util::blessed( $params[0] ) ) {
my $user = $ret{user_object} = shift @params;
croak "Attempted to authenticate user object, but "
. "user doesnt't support 'typekey_credentials'"
unless $user->supports(qw/typekey_credentials/);
$ret{credentials} = $user->typekey_credentials;
} elsif ( @params == 1 and ref( $params[0] ) eq "HASH" ) {
$ret{credentials} = shift @params;
} else {
croak "Invalid parameters";
}
}
lib/Catalyst/Plugin/Authentication/Credential/TypeKey.pm view on Meta::CPAN
foreach my $key (@config_fields) {
# if it was passed as a parameter then move it to the right place
$ret{$key} = delete $params{$key} || $config->{$key};
}
# separate TypeKey's config from credentials
# these options override config
$ret{typekey_config} = {};
foreach my $key (grep { exists $params{$_} } @typekey_config_fields) {
$ret{typekey_config}{$key} = delete $params{$key};
}
lib/Catalyst/Plugin/Authentication/Credential/TypeKey.pm view on Meta::CPAN
# get the object from config and apply local overrides
$ret{typekey_object} = delete $params{typekey_object} || $c->get_typekey_object( %{ $ret{typekey_config} } );
# Authen::TypeKey can also take CGI compatible objects
if ( keys %params ) {
$ret{credentials} = \%params;
} else {
$ret{credentials} = $c->request if not($ret{credentials}) or not( keys %{ $ret{credentials} } );
}
return \%ret;
}
lib/Catalyst/Plugin/Authentication/Credential/TypeKey.pm view on Meta::CPAN
my ( $c, @params ) = @_;
my $params = $c->_munge_typekey_params(@params);
my $typekey = $params->{typekey_object};
my $cred = $params->{credentials};
my $user = $params->{user_object}; # probably undef
my $user_class = $params->{user_class};
my $auth_store = $params->{auth_store};
$c->last_typekey_object($typekey);
lib/Catalyst/Plugin/Authentication/Credential/TypeKey.pm view on Meta::CPAN
Any configuration field (this plugin's configuration, e.g. C<user_class>, as
well as any L<Authen::TypeKey> configuration fields, e.g. C<token>, etc) can
be in %parameters. This will clone the configured typekey object if needed and
set the fields locally for this call only.
All other fields are assumed to be typekey credentials.
If a user object is provided it will be asked for it's typekey credentials and
then authenticated against the server keys.
If there are no typekey credentials in the paramters or the user object, the
credentials will be taken from C<< $c->request >>.
If a user object exists and is authenticated correctly it will be marked as
authenticated. If no such object exists but C<auth_store> is provided (or
configured) then it will attempt to retrieve a user from that store using the
C<name> typekey credential field. If no C<auth_store> is configured or a user
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Catalyst/Plugin/Authentication/Store/HTTP.pm view on Meta::CPAN
=head1 DESCRIPTION
This module is Catalyst authentication storage plugin that
authenticates based on a URL HTTP HEAD fetch using the supplied
credentials. If the fetch succeeds then the authentication succeeds.
L<LWP::UserAgent> is used to fetch the URL which requires authentication,
so any authentication method supported by that module can be used.
Remote authentication methods known to work are:-
lib/Catalyst/Plugin/Authentication/Store/HTTP.pm view on Meta::CPAN
=over 4
=item auth_url
The URL that is fetched to demonstrate that the supplied credentials
work. This can be any URL that L<LWP::UserAgent> will support and
that will support a C<HEAD> method. This item must be supplied.
=item keep_alive
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Catalyst/Authentication/Credential/NoPassword.pm view on Meta::CPAN
=head1 DESCRIPTION
This authentication credential checker takes authentication information
(most often a username) and retrieves the user from the store. No validation
of any credentials is done. This is intended for administrative backdoors,
SAML logins and so on when you have identified the new user by other means.
=head1 CONFIGURATION
# example
view all matches for this distribution
view release on metacpan or search on metacpan
inc/Test/WWW/Mechanize/Catalyst.pm view on Meta::CPAN
{
return $self->SUPER::_make_request($request);
}
$request->authorization_basic(
LWP::UserAgent->get_basic_credentials(
undef, "Basic", $request->uri
)
)
if LWP::UserAgent->get_basic_credentials( undef, "Basic",
$request->uri );
my $response = Test::WWW::Mechanize::Catalyst::Aux::request($request);
$response->header( 'Content-Base', $request->uri );
$response->request($request);
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Catalyst/Authentication/Credential/OAuth2.pm view on Meta::CPAN
}
);
=head1 DESCRIPTION
This module implements authentication via OAuth2 credentials, giving you a
user object which stores tokens for accessing protected resources.
=head1 ATTRIBUTES
=head2 grant_uri
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Catmandu/Adlib/API/Login.pm view on Meta::CPAN
has username => (is => 'ro', required => 1);
has password => (is => 'ro', required => 1);
# login => moet helemaal anders!
sub get_basic_credentials {
my ($self, $realm, $url) = @_;
return $self->username, $self->password;
}
1;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Catmandu/Importer/OAI.pm view on Meta::CPAN
sub _build_oai {
my ($self) = @_;
my $agent = HTTP::OAI::Harvester->new(baseURL => $self->url, resume => 0, keep_alive => 1);
if( $self->has_username && $self->has_password ) {
my $uri = URI->new( $self->url );
my @credentials = (
$uri->host_port,
$self->realm || undef,
$self->username,
$self->password
);
$agent->credentials( @credentials );
}
$agent->env_proxy;
$agent;
}
view all matches for this distribution
view release on metacpan or search on metacpan
examples/pack_example/pack.pl view on Meta::CPAN
# cd examples/pack_example
# perl pack.pl # builds for current platform
# perl pack.pl --platform=linux # cross-target
# perl pack.pl --distribute # build + sign/notarize/DMG (macOS) or AppImage (Linux)
#
# For distribution on macOS, configure signing credentials first:
# Chandra::Pack->config(
# identity => 'Developer ID Application: ...',
# apple_id => 'your@email.com',
# team_id => 'TEAM123',
# );
view all matches for this distribution
view release on metacpan or search on metacpan
share/plotly.js/plotly.min.js view on Meta::CPAN
* The buffer module from node.js, for the browser.
*
* @author Feross Aboukhadijeh <https://feross.org>
* @license MIT
*/
"use strict";var e=t("base64-js"),n=t("ieee754");r.Buffer=a,r.SlowBuffer=function(t){+t!=t&&(t=0);return a.alloc(+t)},r.INSPECT_MAX_BYTES=50;function i(t){if(t>2147483647)throw new RangeError('The value "'+t+'" is invalid for option "size"');var e=ne...
/*! Native Promise Only
v0.8.1 (c) Kyle Simpson
MIT License: http://getify.mit-license.org
*/
!function(t,r,n){r[t]=r[t]||n(),void 0!==e&&e.exports&&(e.exports=r[t])}("Promise",void 0!==t?t:this,(function(){"use strict";var t,e,n,i=Object.prototype.toString,a=void 0!==r?function(t){return r(t)}:setTimeout;try{Object.defineProperty({},"x",{}),...
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Cisco/UCS.pm view on Meta::CPAN
Expires the current authentication token. This method should always be called
on completion of a script to expire the authentication token and free the
current session for use by others. The UCS XML API has a maximum number of
available connections, and a maximum number of sessions per user. In order to
ensure that the session remain available (especially if using common
credentials), you should always call this method on completion of a script, as
an argument to die, or in any eval where a script may fail and exit before
logging out;
=head3 cookie ()
view all matches for this distribution
view release on metacpan or search on metacpan
t/autodb.000.reqs.t view on Meta::CPAN
$errstr or $errstr=DBI->errstr;
my $diag=<<DIAG
These tests require that MySQL be running on 'localhost', that the user
running the tests can access MySQL without a password, and with these
credentials, has sufficient privileges to (1) create a 'test' database,
(2) create, alter, and drop tables in the 'test' database, (3) create and
drop views, and (4) run queries and updates on the database.
When verifying these capabilities, the test driver got the following
error message:
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Class/User/DBI.pm view on Meta::CPAN
my $sth = $self->_db_run( $USER_QUERY{SQL_exists_user}, $self->userid );
return defined $sth->fetchrow_array ? 1 : 0;
}
# Fetch user's salt_hex, pass_hex, ip_required, and valid ip's from database.
sub get_credentials {
my $self = shift;
my $sth = $self->_db_run( $USER_QUERY{SQL_get_credentials}, $self->userid );
my ( $salt_hex, $pass_hex, $ip_required ) = $sth->fetchrow_array;
return if not defined $salt_hex; # User wasn't found.
my @valid_ips = $self->get_valid_ips;
return {
userid => $self->userid,
lib/Class/User/DBI.pm view on Meta::CPAN
# Save ourselves work if user is already authenticated.
if ( !$force_revalidate && $self->validated ) {
return 1;
}
my $credentials = $self->get_credentials;
my $auth = Authen::Passphrase::SaltedSHA512->new(
salt_hex => $credentials->{salt_hex},
hash_hex => $credentials->{pass_hex}
);
if ( !$auth->match($password) ) {
$self->validated(0);
return 0;
}
# Return 0 if an IP is required, and IP param is not in whitelist,
# or no IP parameter passed.
if ( $credentials->{ip_required} ) {
if ( !defined $ip
|| !any { $ip eq $_ } @{ $credentials->{valid_ips} } )
{
$self->validated(0);
return 0;
}
}
lib/Class/User/DBI.pm view on Meta::CPAN
return if !$self->exists_user;
# If an old passphrase is supplied, only update if it validates.
if ( defined $oldpass ) {
my $credentials = $self->get_credentials;
my $auth = Authen::Passphrase::SaltedSHA512->new(
salt_hex => $credentials->{salt_hex},
hash_hex => $credentials->{pass_hex}
);
# Return undef if password doesn't authenticate for the user.
return unless $auth->match($oldpass); ## no critic (postfix)
}
lib/Class/User/DBI.pm view on Meta::CPAN
__END__
=head1 NAME
Class::User::DBI - A User class: Login credentials, roles, privileges, domains.
=head1 VERSION
Version 0.10
=head1 SYNOPSIS
This module models a "User" class, with login credentials, and Roles Based
Access Control. Additionally, IP whitelists may be used as an additional
validation measure. Domain (locality) based access control is also provided
independently of role based access control.
A brief description of authentication: Passphrases are stored as randomly
lib/Class/User/DBI.pm view on Meta::CPAN
my $validated = $user->validated;
my $invalidated = $user->validated(0); # Cancel authentication.
my $is_valid = $user->validate( $pass, $ip ); # Validate including IP.
my $is_valid = $user->validate( $pass ); # Validate without IP.
my $info_href = $user->load_profile;
my $credentials = $user->get_credentials; # Returns a useful hashref.
my @valid_ips = $user->get_valid_ips;
my $ip_required = $user->get_ip_required;
my $success = $user->set_ip_required(1);
my $ exists = $user->exists_user;
my $success = $user->delete_user;
lib/Class/User/DBI.pm view on Meta::CPAN
The module is designed to simplify user logins, authentication, role based
access control (authorization), as well as domain (locality) constraint access
control.
It stores user credentials, roles, and basic user information in a database via
a DBIx::Connector database connection.
User passphrases are salted with a 512 bit random salt (unique per user) using
a cryptographically strong random number generator, and converted to a SHA2-512
digest before being stored in the database. All subsequent passphrase
lib/Class/User/DBI.pm view on Meta::CPAN
Use L<Class::User::DBI::Domains> to create a list of domains (localities), along
with their descriptions.
Use L<Class::User::DBI> (This module) to create a set of users, establish
login credentials such as passphrases and optional IP whitelists, and assign
them roles.
Use L<Class::User::DBI::UserDomains> to associate one or more localities
(domains) with each user.
lib/Class/User/DBI.pm view on Meta::CPAN
database, such as C<< $user->delete_user >> will remove the cache entry, and
subsequent tests will access the database on each call to C<exists_user()>,
until such time that the result flips to positive again.
=head2 get_credentials
my $credentials_href = $user->get_credentials;
my @fields = qw( userid salt_hex pass_hex ip_required );
foreach my $field ( @fields ) {
print "$field => $credentials_href->{$field}\n";
}
my @valid_ips = @{$valid_ips};
foreach my $ip ( @valid_ips ) {
print "Whitelisted IP: $ip\n";
}
Accepts no parameters. Returns a hashref holding a small datastructure that
describes the user's credentials. The structure looks like this:
$href = {
userid => $userid, # The target user's userid.
salt_hex => $salt, # A 128 hex-character representation of
lib/Class/User/DBI.pm view on Meta::CPAN
A typical usage probably won't require calling this function directly very
often, if at all. In most cases where it would be useful to look at the salt,
the passphrase digest, and IP whitelists, the
C<< $user->validate( $passphrase, $ip ) >> method is easier to use and less
prone to error. But for those cases I haven't considered, the
C<get_credentials()> method exists.
=head2 get_role
my $user_role = $user->get_role;
lib/Class/User/DBI.pm view on Meta::CPAN
=head1 DIAGNOSTICS
If you find that your particular database engine is not playing nicely with the
test suite from this module, it may be necessary to provide the database login
credentials for a test database using the same engine that your application
will actually be using. You may do this by setting C<$ENV{CUDBI_TEST_DSN}>,
C<$ENV{CUDBI_TEST_DATABASE}>, C<$ENV{CUDBI_TEST_USER}>,
and C<$ENV{CUDBI_TEST_PASS}>.
Currently the test suite tests against a SQLite database since it's such a
lightweight dependency for the testing. The author also uses this module
with several MySQL databases. As you're configuring your database, providing
its credentials to the tests and running the test scripts will offer really
good diagnostics if some aspect of your database tables proves to be at odds
with what this module needs.
Be advised that the the test suite drops its tables after completion, so be sure
to run the test suite only against a database set up explicitly for testing
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Class/Usul/Schema.pm view on Meta::CPAN
}
return OK;
}
sub create_schema : method { # Create databases and edit credentials
my $self = shift;
my $default = $self->yes;
my $text = 'Schema creation requires a database, id and password. '
. 'For Postgres the driver is Pg and the port 5432. For '
. 'MySQL the driver is mysql and the port 3306';
$self->output( $text, AS_PARA );
$self->yorn( '+Create database schema', $default, TRUE, 0 ) or return OK;
$self->edit_credentials;
$self->connect_options;
$self->drop_database;
$self->drop_user;
$self->create_user;
$self->create_database;
lib/Class/Usul/Schema.pm view on Meta::CPAN
$self->debug and $self->dumper( $r );
return OK;
}
sub edit_credentials : method {
my $self = shift;
my $self_cfg = $self->config;
my $db = $self->database;
my $bootstrap = $self->options->{bootstrap};
my $cfg_data = $bootstrap ? {} : $self->load_config_data( $self_cfg, $db );
lib/Class/Usul/Schema.pm view on Meta::CPAN
$field ne 'name' and $self->$setter( $value // NUL );
$is_pw and $value = encrypt_for_config $self_cfg, $value, $stored_pw;
$copts->{ $field } = $value // NUL;
}
$cfg_data->{credentials}->{ $copts->{name} } = $copts;
$self->dry_run and $self->dumper( $cfg_data ) and return OK;
$self->dump_config_data( $self_cfg, $copts->{name}, $cfg_data );
return OK;
}
lib/Class/Usul/Schema.pm view on Meta::CPAN
=head2 create_schema - Creates a database then deploys and populates the schema
$self->create_schema;
Calls L<edit_credentials>, L<create_database>, L<create_user>, and
L<deploy_and_populate>
=head2 create_user - Creates a database user
$self->create_user;
lib/Class/Usul/Schema.pm view on Meta::CPAN
$self->dsn;
Returns the DSN from the call to
L<get_connect_info|Class::Usul::TraitFor::ConnectInfo/get_connect_info>
=head2 edit_credentials - Edits the database login information
$self->edit_credentials;
Encrypts the database connection password before storage
=head2 execute_ddl
view all matches for this distribution
view release on metacpan or search on metacpan
lib/ClearPress/authenticator/db.pm view on Meta::CPAN
}
return $DEFAULT_CIPHER;
}
sub authen_credentials {
my ($self, $ref) = @_;
if(!$ref ||
!$ref->{username} ||
!$ref->{password} ) {
lib/ClearPress/authenticator/db.pm view on Meta::CPAN
=head2 dbh - get/set accessor for database handle to use for query
$oDBAuth->dbh($oDBH);
my $oDBH = $oDBAuth->dbh();
=head2 authen_credentials - attempt to authenticate against database using given username & password
my $hrAuthenticated = $oDBAuth->authen_credentials({username => $sUsername, password => $sPassword});
returns undef or hashref
=head1 DIAGNOSTICS
view all matches for this distribution
view release on metacpan or search on metacpan
lib/CloudApp/REST.pm view on Meta::CPAN
my $params = shift;
my $email = $params->{email} || $params->{username} || $params->{user} || $self->email || die "You have to provide an email address";
my $pass = $params->{password} || $params->{pass} || $self->password || die "You have to provide a password";
$self->useragent->credentials($self->auth_netloc, $self->auth_realm, $email, $pass);
return 1;
}
=head2 account_register
view all matches for this distribution
view release on metacpan or search on metacpan
lib/CCfnX/VagrantDeployer.pm view on Meta::CPAN
@lines = @{ $self->origin->Resource('Instance')->Properties->UserData->process_with_context($self->origin, \@lines) };
my $content = join '', @lines;
$content =~ s/\\/\\\\/;
warn "I'm extending a 900 second (15 min) token with you're actual credentials to vagrant";
my $creds = Paws::Credential::ProviderChain->new();
my $aws_access_key = $creds->access_key;
my $aws_secret_key = $creds->secret_key;
lib/CCfnX/VagrantDeployer.pm view on Meta::CPAN
my $vag_file = '
VAGRANTFILE_API_VERSION = "2"
$script = <<SCRIPT
#!/bin/bash
# Create temporary credentials
export AWS_ACCESS_KEY_ID=' . $aws_access_key . '
export AWS_SECRET_ACCESS_KEY=' . $aws_secret_key . '
export AWS_SESSION_TOKEN=' . $aws_token . '
cat > /etc/skel/.aws_creds <<ALIASES
export AWS_ACCESS_KEY_ID=' . $aws_access_key . '
export AWS_SECRET_ACCESS_KEY=' . $aws_secret_key . '
export AWS_SESSION_TOKEN=' . $aws_token . '
ALIASES
' . $content . '
# Clean temporary credentials
rm -f /etc/skel/.aws_creds
find /home -type f -name ".aws_creds" -delete
SCRIPT
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
view all matches for this distribution
view release on metacpan or search on metacpan
lib/CloudFlare/Client.pm view on Meta::CPAN
use LWP::Protocol::https 6.02;
use JSON::MaybeXS;
our $VERSION = 'v0.55.4'; # VERSION
# CF credentials
has '_user' => (
is => 'ro',
isa => Str,
required => 1,
init_arg => 'user',);
view all matches for this distribution
view release on metacpan or search on metacpan
lib/CloudHealth/API.pm view on Meta::CPAN
has call_former => (is => 'ro', isa => HasMethods['params2request'], default => sub {
require CloudHealth::API::CallObjectFormer;
CloudHealth::API::CallObjectFormer->new;
});
has credentials => (is => 'ro', isa => HasMethods['api_key'], default => sub {
require CloudHealth::API::Credentials;
CloudHealth::API::Credentials->new;
});
has io => (is => 'ro', isa => HasMethods['call'], default => sub {
require CloudHealth::API::Caller;
lib/CloudHealth/API.pm view on Meta::CPAN
CloudHealth::API::ResultParser->new
});
sub _invoke {
my ($self, $method, $params) = @_;
my $req = $self->call_former->params2request($method, $self->credentials, $params);
my $result = $self->io->call($req);
return $self->result_parser->result2return($result);
}
sub method_classification {
lib/CloudHealth/API.pm view on Meta::CPAN
=head1 AUTHENTICATION
As the documentation states, you need an API KEY to query the API. The default authentication
mechanism expects to find that API key in the C<CLOUDHEALTH_APIKEY> environment variable.
You can also pass any object that implements an C<api_key> method to the C<credentials> attribute
of the constructor
=head1 RESULTS
Results are returned as a Perl HashRef representing the JSON returned by the API.
view all matches for this distribution
view release on metacpan or search on metacpan
bin/cloudhealth view on Meta::CPAN
return $arg_parser->parse;
});
has argv => (is => 'ro', isa => ArrayRef, required => 1);
has ch => (is => 'ro', lazy => 1, default => sub { CloudHealth::API->new });
has credentials_detected => (is => 'ro', isa => Bool, lazy => 1, default => sub {
my $self = shift;
$self->ch->credentials->is_set;
});
has run_method => (is => 'ro', isa => Maybe[Str], lazy => 1, default => sub { shift->argv->[0] });
has method_specified => (is => 'ro', isa => Bool, lazy => 1, default => sub {
bin/cloudhealth view on Meta::CPAN
});
sub usage {
my $self = shift;
say " * Didn't detect credentials. Set env CLOUDHEALTH_APIKEY" if (not $self->credentials_detected);
say " * Didn't specify the method to call" if (not $self->method_specified);
say sprintf(" * Don't know method %s", $self->run_method) if ($self->method_specified and not $self->method_exists);
if (not $self->method_specified or not $self->method_exists or $self->wants_help) {
say 'The following methods are available:';
foreach my $kind (sort keys %{ $self->ch->method_classification }) {
bin/cloudhealth view on Meta::CPAN
}
sub run {
my ($self) = shift;
return $self->usage if (not $self->credentials_detected);
return $self->usage if (not $self->method_specified);
return $self->usage if (not $self->method_exists);
return $self->usage if ($self->wants_help);
my $method = $self->run_method;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Clustericious/Client.pm view on Meta::CPAN
has server_url => '';
has [qw(tx res userinfo ua )];
has _remote => ''; # Access via remote()
has _cache => sub { + {} }; # cache of credentials
sub client
{
carp "Clustericious::Client->client is deprecated (use ua instead)";
shift->ua(@_);
lib/Clustericious/Client.pm view on Meta::CPAN
$self->tx($tx);
my $auth_header;
if (($tx->res->code||0) == 401 && ($auth_header = $tx->res->headers->www_authenticate)
&& !$url->userinfo && ($self->_has_auth || $self->_can_auth)) {
DEBUG "received code 401, trying again with credentials";
my ($realm) = $auth_header =~ /realm=(.*)$/i;
my $host = $url->host;
$self->login( $self->_has_auth ? () : $self->_get_user_pw($host,$realm) );
return $self->_doit($meta ? $meta : (), @_);
}
view all matches for this distribution
view release on metacpan or search on metacpan
examples/helloworld/app/lib/App/Controller/ApiBase.pm view on Meta::CPAN
'CGI::SpeedyCGI' => {},
'MouseX::Types::Common' => {},
'CORS' => {
origin => c->base_url,
credentials => 1,
headers => [qw/X-Requested-With Authorization Content-Type/],
maxage => 7200,
},
'JSON' => {
view all matches for this distribution
view release on metacpan or search on metacpan
examples/02-user-management.pl view on Meta::CPAN
=item * Verify operations succeeded before proceeding
=item * Handle error messages appropriately for your application
=item * Test that old credentials no longer work after resets/deletions
=back
=head1 SEE ALSO
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Concierge.pm view on Meta::CPAN
use Concierge::User;
# === PARAMETER FILTERS ===
# Shared filters for secure data segregation
# Auth filter - ONLY credentials (user_id + password)
our $auth_data_filter = make_filter(
[qw(user_id password)], # required credentials
[], # accepted - nothing else
[], # excluded - not needed
);
# User data filter - everything EXCEPT credentials
# Handles both minimal input (user_id, moniker) and
# rich input (user_id, moniker, email, phone, bio, etc.)
our $user_data_filter = make_filter(
[qw(user_id moniker)], # required minimum
['*'], # accept ALL other fields, except:
[qw(password confirm_password)], # excluded - security boundary
);
# Session data filter - for populating session with initial data
# Accepts user_id (required for new_session) plus any session fields
# Excludes credentials (never stored in session data)
our $session_data_filter = make_filter(
[qw(user_id)], # required for new_session
['*'], # accept all other fields, except:
[qw(password confirm_password)], # excluded - security boundary
);
lib/Concierge.pm view on Meta::CPAN
};
}
}
# Login user: authenticate, create session, assign user_key and store external_key mapping
sub login_user ($self, $credentials, $session_opts={}) {
# Step 0: Get credentials
my $auth_data = $auth_data_filter->($credentials);
return { success => 0, message => 'Missing user_id or password' }
unless $auth_data;
my $user_id = $auth_data->{user_id};
my $password = $auth_data->{password};
lib/Concierge.pm view on Meta::CPAN
Assigned an identifier and a session. Can store temporary data (e.g., a
shopping cart). No authentication or persistent user record.
=item B<Logged-in user> -- C<login_user()>
Authenticated with credentials. Has a session, persistent user data, and
full access to the User object's data methods.
=back
A guest can be converted to a logged-in user with C<login_guest()>,
lib/Concierge.pm view on Meta::CPAN
C<%session_opts> hashref may include C<timeout> (in seconds; defaults to
1800).
=head3 login_user
my $result = $concierge->login_user(\%credentials, \%session_opts);
my $user = $result->{user}; # Concierge::User (logged-in)
Authenticates C<user_id> and C<password> from C<%credentials>, retrieves
the user's data record, creates a session, and returns a fully-equipped
User object. If the user already has an active session, the previous
session is replaced.
=head3 restore_user
lib/Concierge.pm view on Meta::CPAN
Returns C<< { success => 1, user => $user } >> on success. Guest restores
also include C<< is_guest => 1 >>.
=head3 login_guest
my $result = $concierge->login_guest(\%credentials, $guest_user_key);
my $user = $result->{user}; # Concierge::User (logged-in)
Converts a guest to a logged-in user. Authenticates with C<%credentials>,
transfers any data from the guest's session to the new session, then
deletes the guest session and removes the guest's user_key mapping.
=head3 logout_user
lib/Concierge.pm view on Meta::CPAN
=item C<$user_update_filter> -- excludes C<user_id> and C<password> from updates
=back
These ensure that credentials never leak into user data stores and that
identity fields cannot be changed via update operations.
=head1 SEE ALSO
L<Concierge::Setup> -- desk creation and configuration
view all matches for this distribution