view release on metacpan or search on metacpan
lib/AFS/PAG.pm view on Meta::CPAN
}
=head1 DESCRIPTION
AFS is a distributed file system allowing cross-platform sharing of files
among multiple computers. It associates client credentials (called AFS
tokens) with a Process Authentication Group, or PAG. AFS::PAG makes
available in Perl the PAG manipulation functions provided by the libkafs
or libkopenafs libraries.
With the functions provided by this module, a Perl program can detect
lib/AFS/PAG.pm view on Meta::CPAN
Note that this module doesn't provide a direct way to obtain new AFS
tokens. Programs that need AFS tokens should normally obtain Kerberos
tickets (via whatever means) and then run the program B<aklog>, which
comes with most AFS distributions. This program will create AFS tokens
from the current Kerberos ticket cache and store them in the current PAG.
To isolate those credentials from the rest of the system, call setpag()
before running B<aklog>.
=head1 FUNCTIONS
This module provides the following functions, none of which are exported
view all matches for this distribution
view release on metacpan or search on metacpan
);
# call to create() is mostly safe, you might get an error
# back but still 200 OK. You can avoid this (and wasting one
# API call) if you know the nick is already active for these
# API credentials.
$cleverbot->create();
# then, it's just... ask()
my $answer = $cleverbot->ask('Hello darling!');
say $answer->{response};
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AMF/Connection.pm view on Meta::CPAN
$self->{'ua'}->cookie_jar( $self->{'http_cookie_jar'} );
return bless($self, $class);
};
# plus add paramters, referer, user agent, authentication/credentials ( see also SecureAMFChannel stuff ),
# plus timezone on retunred dates to pass to de-serializer - see AMF3 spec saying "it is suggested that time zone be queried independnetly as needed" - unelss local DateTime default to right locale!
# we pass the string, and let Storable::AMF to parse the options into a scalar - see Input/OutputStream and Storable::AMF0 documentation
sub setInputAMFOptions {
lib/AMF/Connection.pm view on Meta::CPAN
$request->setEncoding( $class->{'encoding'} );
# add AMF any request headers
map { $request->addHeader( $_ ); } @{ $class->{'headers'} };
# TODO - prepare HTTP/S request headers based on AMF headers received/set if any - and credentials
foreach my $call (@batch)
{
next
unless (defined $call && ref ($call) =~ m/HASH/
view all matches for this distribution
view release on metacpan or search on metacpan
doc/examples/petmarket/petmarket/api/userservice.pm view on Meta::CPAN
sub methodTable
{
return {
"addUser" => {
"description" => "Add a user with the given credentials",
"access" => "remote",
},
"getUser" => {
"description" => "Add a user with the given credentials",
"access" => "remote",
},
"updateUser" => {
"description" => "Add a user with the given credentials",
"access" => "remote",
},
};
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/API/INSEE/Sirene.pm view on Meta::CPAN
],
};
sub new {
my $class = shift;
my ($credentials, $timeout, $max_results, $proxy) = @_;
my $self = bless {
credentials => $credentials,
user_agent => undef,
token_expiration => undef,
max_results => undef,
debug_mode => 0,
current_endpoint => undef,
lib/API/INSEE/Sirene.pm view on Meta::CPAN
return $self;
}
sub setCredentials {
my ($self, $credentials) = @_;
$self->{'credentials'} = $credentials;
}
sub setMaxResults {
my ($self, $max_results) = @_;
lib/API/INSEE/Sirene.pm view on Meta::CPAN
}
sub _getToken {
my $self = shift;
croak 'Please provide your credentials.' if !defined $self->{'credentials'};
my $request = POST API_AUTH_URL,
Authorization => "Basic $self->{'credentials'}",
Content => [ grant_type => 'client_credentials' ];
my $response = $self->{'user_agent'}->request($request);
my $json_obj;
if ($response->content_type =~ m/^application\/json/) {
lib/API/INSEE/Sirene.pm view on Meta::CPAN
case HTTP_OK {
$self->{'token_expiration'} = time + $json_obj->{'expires_in'};
$self->{'user_agent'}->default_header( Authorization => "Bearer $json_obj->{'access_token'}" );
return 0;
}
case HTTP_UNAUTHORIZED { # wrong credentials
return 1 , $json_obj->{'error_description'};
}
else { # oh dear we are in trouble
return 1, $self->_dumpRequest($request, $response);
}
lib/API/INSEE/Sirene.pm view on Meta::CPAN
=head1 SYNOPSIS
use API::INSEE::Sirene;
my $sirene = API::INSEE::Sirene->new('Y29uc3VtZXIta2V5OmNvbnN1bWVyLXNlY3JldA=='); # your base64 encoded credentials
$sirene->setMaxResults(30);
# Examples to get information about an establishment with SIRET number '12345678987654'
$sirene->getEstablishmentBySIRET(12345678987654, 'all');
lib/API/INSEE/Sirene.pm view on Meta::CPAN
Search all legal units which SIREN number is begining by the number given in parameter.
=head2 setCredentials
You can set your credentials separately from the instantiation if you need to (but this must be done before any call to the search methods).
$sirene->setCredentials('Y29uc3VtZXIta2V5OmNvbnN1bWVyLXNlY3JldA==');
=head2 setCurrentEndpoint
view all matches for this distribution
view release on metacpan or search on metacpan
lib/API/Instagram.pm view on Meta::CPAN
my $access_token = $instagram->get_access_token;
=head3 Request
With the access token its possible to do Instagram API requests using the
authenticated user credentials.
$instagram->access_token( $access_token );
my $me = $instagram->user;
print $me->full_name;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/API/ParallelsWPB/Requests.pm view on Meta::CPAN
This parameter is optional. It specifies whether the site is in trial mode, suspended or active (regular value). Sites in trial mode can be edited, but cannot be published to a hosting account.
publicationSettings
This parameter is optional. It specifies where to publish the site over FTP and what account credentials to use:
ownerInfo
This parameter is optional. It specifies the contact information of the site owner.
view all matches for this distribution
view release on metacpan or search on metacpan
lib/ARS/Simple.pm view on Meta::CPAN
ARS::Simple - A simplified interface to Remedy ARSystem
=head1 SYNOPSIS
A simple interface to Remedy ARSystem utilising the ARSperl API interface.
Keeps your code more readable and by use of the cache avoids your credentials
being spread through all your scripts.
use ARS::Simple;
my $ar = ARS::Simple->new({
view all matches for this distribution
view release on metacpan or search on metacpan
lib/ASNMTAP/Asnmtap/Plugins/SOAP.pm view on Meta::CPAN
sub get_soap_request {
my %defaults = ( asnmtapInherited => undef,
custom => undef,
customArguments => undef,
proxy => undef,
credentials => undef,
namespace => undef,
registerNamespace => undef,
method => undef,
soapaction => undef,
xmlContent => undef,
lib/ASNMTAP/Asnmtap/Plugins/SOAP.pm view on Meta::CPAN
$service->proxy ( $parms{proxy}, timeout => $timeout );
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
$service->transport->credentials( @{$parms{credentials}} ) if ( defined $parms{credentials} );
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# $service->proxy ( 'https://USERNAME:PASSWORD@secure.citap.be/authorization/hibye.cgi' );
# or
# $service->proxy ( 'https://secure.citap.be/authorization/hibye.cgi', credentials => [ 'secure.citap.be:443', "ASNMTAP's Authorization Access", 'USERNAME' => 'PASSWORD' ], timeout => $timeout );
# or
# $service->transport->credentials( 'secure.citap.be:443', "ASNMTAP's Authorization Access", 'USERNAME' => 'PASSWORD' );
# or
# use MIME::Base64;
# $service->transport->http_request->header( 'Authorization' => 'Basic '. MIME::Base64::encode ( 'USERNAME' .':'. 'PASSWORD', '' ) );
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
view all matches for this distribution
view release on metacpan or search on metacpan
lib/ASP4.pm view on Meta::CPAN
$self->{password} = $self->hash_password( $new );
}
});
# Verify an email/password combination and return the user if a match is found:
sub check_credentials {
my ($self, %args) = @_;
my ($result) = $self->search(
email => $args{email},
password => $self->hash_password( $args{password} ),
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AWS/CLI/Config.pm view on Meta::CPAN
return $ENV{$env_var};
}
my $profile = shift || _default_profile();
my $credentials = credentials($profile);
if ($credentials && $credentials->$profile_key) {
return $credentials->$profile_key;
}
my $config = config($profile);
if ($config && $config->$profile_key) {
return $config->$profile_key;
lib/AWS/CLI/Config.pm view on Meta::CPAN
return undef;
};
}
sub credentials {
my $profile = shift || _default_profile();
$CREDENTIALS ||= _parse(
(exists $ENV{AWS_CONFIG_FILE} and $ENV{AWS_CONFIG_FILE})
? $ENV{AWS_CONFIG_FILE}
: File::Spec->catfile(_default_dir(), 'credentials')
);
return unless (exists $CREDENTIALS->{$profile});
$CREDENTIALS_PROFILE_OF{$profile} ||=
AWS::CLI::Config::Profile->new($CREDENTIALS->{$profile});
lib/AWS/CLI/Config.pm view on Meta::CPAN
=encoding UTF-8
=head1 NAME
AWS::CLI::Config - Interface to access AWS CLI configs and credentials
=head1 SYNOPSIS
use AWS::CLI::Config;
my $aws_access_key_id = AWS::CLI::Config::access_key_id;
lib/AWS/CLI/Config.pm view on Meta::CPAN
my $region = AWS::CLI::Config::region($profile);
=head1 DESCRIPTION
B<AWS::CLI::Config> provides an interface to access AWS CLI configuration and
credentials. It fetches its values from the appropriate environment variables,
or a credential or config file in the order described in
L<AWS CLI Documents|http://docs.aws.amazon.com/cli/>.
=head1 SUBROUTINES
lib/AWS/CLI/Config.pm view on Meta::CPAN
=head2 output (Str)
Fetches I<output> defined in the credential or config file. You can optionally
specify the profile as the first argument.
=head2 credentials (Str)
Fetches information from the credential file if it exists. You can optionally
specify the profile as the first argument.
=head2 config (Str)
lib/AWS/CLI/Config.pm view on Meta::CPAN
Please note, however, that accessors will B<not> be generated for nested values.
=head1 LIMITATIONS
"Instance profile credentials" are not yet supported by this module.
=head1 SEE ALSO
=over 4
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AWS/CLIWrapper.pm view on Meta::CPAN
AWS::CLIWrapper is wrapper module for aws-cli (recommend: awscli >= 1.0.0, requires: >= 0.40.0).
AWS::CLIWrapper is a just wrapper module, so you can do everything what you can do with aws-cli.
See note below about making sure AWS credentials are accessible (especially under crond)
=head1 METHODS
=over 4
lib/AWS/CLIWrapper.pm view on Meta::CPAN
=head1 ENVIRONMENT
=over 4
=item HOME: used by default by /usr/bin/aws utility to find it's credentials (if none are specified)
Special note: cron on Linux will often have a different HOME "/" instead of "/root" - set $ENV{'HOME'}
to use the default credentials or specify $ENV{'AWS_CONFIG_FILE'} directly.
=item AWS_CLIWRAPPER_TIMEOUT
If this variable is set, this value will be used instead of default timeout (30 seconds) for every
invocation of `aws-cli` that does not have a timeout value provided in the options argument of the
lib/AWS/CLIWrapper.pm view on Meta::CPAN
relaying the error to calling code. While this approach is beneficial 99% of the time,
in some use cases `aws-cli` execution fails for a temporary reason unrelated to
both calling code and AWS::CLIWrapper, and can be safely retried after a short delay.
One of this use cases is executing `aws-cli` on AWS EC2 instances, where `aws-cli`
retrieves its configuration and credentials from the API exposed to the EC2 instance;
at certain times these credentials may be rotated and calling `aws-cli` at exactly
the right moment will cause it to fail with `Unable to locate credentials` error.
To prevent this kind of errors from failing the calling code, AWS::CLIWrapper allows
configuring an RegExp pattern and retry `aws-cli` execution if it fails with an error
matching the configured pattern.
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AWS/Lambda/Quick.pm view on Meta::CPAN
=back
=head2 Installing the CLI tools
This module requires you to have the version 1 AWS CLI tools installed
on your system and configured with your authentication credentials.
Installing the tools are covered in many AWS guides, but can be
quickly summarized as:
shell$ curl "https://s3.amazonaws.com/aws-cli/awscli-bundle.zip" -o "awscli-bundle.zip"
shell$ unzip awscli-bundle.zip
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AWS/S3/Signer/V4.pm view on Meta::CPAN
$uri->query_param( 'X-Amz-Date' => $self->_datetime($request) );
$uri->query_param( 'X-Amz-Expires' => $expires ) if $expires;
$uri->query_param( 'X-Amz-SignedHeaders' => 'host' );
# If there was a security token passed, we need to supply it as part of the authorization
# because AWS requires it to validate IAM Role temporary credentials.
if ( defined( $self->{security_token} ) ) {
$uri->query_param( 'X-Amz-Security-Token' => $self->{security_token} );
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AWS/Signature4.pm view on Meta::CPAN
$uri->query_param('X-Amz-Date' => $self->_datetime($request));
$uri->query_param('X-Amz-Expires' => $expires) if $expires;
$uri->query_param('X-Amz-SignedHeaders' => 'host');
# If there was a security token passed, we need to supply it as part of the authorization
# because AWS requires it to validate IAM Role temporary credentials.
if (defined($self->{security_token})) {
$uri->query_param('X-Amz-Security-Token' => $self->{security_token});
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AXL/Client/Simple/Phone.pm view on Meta::CPAN
=over 4
=item C<< client => >> C<AXL::Client::Simple> object (required)
An instance of C<AXL::Client::Simple> which has been configured with your
server location, user credentials and SOAP APIs. This will be stored as a weak
reference.
=item C<< stash => >> Hash Ref (required)
This hash reference contains the raw data returned from the Unified
view all matches for this distribution
view release on metacpan or search on metacpan
devdata/https_mojolicious.io_blog_2017_12_16_day-16-the-secret-life-of-sessions view on Meta::CPAN
<p>and restart the application.
Any requests with valid sessions will still work.
The reply they receive will contain a new session cookie, as always, but this time it will be issued using the new secret!</p>
<p>Requests issued by the old credentials will slowly be replaced by new ones as clients each make their first requests following the change.
Once you wait long enough that any valid session cookie would have expired, you can remove the old secret from the configuration and restart again.</p>
<h2>Restarting</h2>
<p>This is a good time to mention <a href="http://mojolicious.org/perldoc/Mojolicious/Guides/Cookbook#Hypnotoad"><code>hypnotoad</code></a>.
view all matches for this distribution
view release on metacpan or search on metacpan
devdata/https_mojolicious.io_blog_2018_12_01_welcome-mojoconf-recap_ view on Meta::CPAN
<blockquote>
<p>Practicing your live demo includes practicing logging in.
<cite>Joel Berger, today</cite></p>
</blockquote>
<p>That's right, I forgot the login credentials to my own demo.</p>
<p>That said, most of the talk still worked.
So beyond that first lesson, here's one more: even experienced speakers mess up, we shrug and move on.
Don't let fear of failure stop you from speaking to groups of like minded colleagues about the work you do.</p>
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Activiti/Rest/Response.pm view on Meta::CPAN
error_message => $exception,
exception => $exception
};
#The operation failed. The operation requires an Authentication header to be set. If this was present in the request, the supplied credentials are not valid or the user is not authorized to perform this operation.
if($code eq "401"){
Activiti::Rest::Error::UnAuthorized->throw($args);
}
#The operation is forbidden and should not be re-attempted. This does not imply an issue with authentication not authorization, it's an operation that is not allowed. Example: deleting a task that is part of a running process is not allowed and w...
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Ado/Plugin/Auth.pm view on Meta::CPAN
$c->redirect_to($c->session('over_route'));
return;
}
else {
unless ($c->res->code // '' eq '403') {
$c->stash(error_login => 'Wrong credentials! Please try again!');
$c->render(status => 401, template => 'login');
return;
}
}
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Akamai/Open/DiagnosticTools.pm view on Meta::CPAN
All API calls for the DiagnosticTools API are described and explained
at the L<Akamai Open DiagnosticTools API Portal|https://developer.akamai.com/api/luna/diagnostic-tools/reference.html>.
=head2 Akamai::Open::DiagnosticTools->new(client => $client)
For every I<Akamai::Open> API call you'll need some client credentials.
These are provided by the L<Akamai::Open:Client|http://search.cpan.org/perldoc?Akamai::Open::Client>
module and can reviewed at the LUNA control center.
A succesfull call to I<new()> will return a I<Moose> powered
I<Akamai::Open::DiagnosticTools> object.
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Alice/HTTP/Server.pm view on Meta::CPAN
if (!$self->auth_enabled) {
$res->redirect($dest);
$res->send;
}
# we have credentials
elsif (my $user = $req->param('username')
and my $pass = $req->param('password')) {
$self->authenticate($user, $pass, sub {
my $app = shift;
view all matches for this distribution
view release on metacpan or search on metacpan
corpus/alien_build_plugin_fetch_wget/record/old.json view on Meta::CPAN
{"-k --content-disposition -S http://localhost/corpus/alien_build_plugin_fetch_wget/dir/foo-1.01.tar":{"stderr":"--2021-05-12 00:10:35-- http://localhost/corpus/alien_build_plugin_fetch_wget/dir/foo-1.01.tar\nResolving localhost (localhost)... ::1, ...
view all matches for this distribution
view release on metacpan or search on metacpan
src/subversion/subversion/bindings/swig/perl/native/Core.pm view on Meta::CPAN
Password.
=item $simple-E<gt>may_save()
Indicates if the credentials may be saved (to disk).
=back
=cut
src/subversion/subversion/bindings/swig/perl/native/Core.pm view on Meta::CPAN
Username.
=item $username-E<gt>may_save()
Indicates if the credentials may be saved (to disk).
=back
=cut
src/subversion/subversion/bindings/swig/perl/native/Core.pm view on Meta::CPAN
=over 4
=item $strust-E<gt>may_save()
Indicates if the credentials may be saved (to disk).
=item $strust-E<gt>accepted_failures()
Bit mask of the accepted failures.
src/subversion/subversion/bindings/swig/perl/native/Core.pm view on Meta::CPAN
Full paths to the certificate file.
=item $ccert-E<gt>may_save()
Indicates if the credentials may be saved (to disk).
=back
=cut
src/subversion/subversion/bindings/swig/perl/native/Core.pm view on Meta::CPAN
Certificate password.
=item $ccertpw-E<gt>may_save()
Indicates if the credentials may be saved (to disk).
=back
=cut
view all matches for this distribution
view release on metacpan or search on metacpan
share/swagger-ui-bundle.js view on Meta::CPAN
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(function(){try{return require("esprima")}catch(e){}}()):"function"==typeof define&&define.amd?define(["esprima"],t):"object"==typeof exports?exports.SwaggerUIBundle=t(f...
/*
object-assign
(c) Sindre Sorhus
@license MIT
*/var r=Object.getOwnPropertySymbols,o=Object.prototype.hasOwnProperty,i=Object.prototype.propertyIsEnumerable;function a(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}e.exports=function()...
/*!
Copyright (c) 2017 Jed Watson.
Licensed under the MIT License (MIT), see
http://jedwatson.github.io/classnames
*/
share/swagger-ui-bundle.js view on Meta::CPAN
* The buffer module from node.js, for the browser.
*
* @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
* @license MIT
*/
var r=n(569),o=n(570),i=n(355);function a(){return u.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function s(e,t){if(a()<t)throw new RangeError("Invalid typed array length");return u.TYPED_ARRAY_SUPPORT?(e=new Uint8Array(t)).__proto__=u.prototype:(null=...
/*!
* @description Recursive object extending
* @author Viacheslav Lotsmanov <lotsmanov89@gmail.com>
* @license MIT
*
share/swagger-ui-bundle.js view on Meta::CPAN
/*!
* https://github.com/Starcounter-Jack/JSON-Patch
* (c) 2017 Joachim Wester
* MIT license
*/
var n=this&&this.__extends||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);function r(){this.constructor=e}e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)},r=Object.prototype.hasOwnProperty;function o(e,t){return ...
/** @license React v16.8.6
* react-is.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
share/swagger-ui-bundle.js view on Meta::CPAN
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
function n(e){return e instanceof t||e instanceof Date||e instanceof RegExp}function r(e){if(e instanceof t){var n=t.alloc?t.alloc(e.length):new t(e.length);return e.copy(n),n}if(e instanceof Date)return new Date(e.getTime());if(e instanceof RegExp)r...
/*!
* cookie
* Copyright(c) 2012-2014 Roman Shtylman
* Copyright(c) 2015 Douglas Christopher Wilson
* MIT Licensed
*/t.parse=function(e,t){if("string"!=typeof e)throw new TypeError("argument str must be a string");for(var n={},o=t||{},a=e.split(i),u=o.decode||r,c=0;c<a.length;c++){var l=a[c],p=l.indexOf("=");if(!(p<0)){var f=l.substr(0,p).trim(),h=l.substr(++p,l...
/*!
* repeat-string <https://github.com/jonschlinkert/repeat-string>
*
* Copyright (c) 2014-2015, Jon Schlinkert.
* Licensed under the MIT License.
share/swagger-ui-bundle.js view on Meta::CPAN
*
* Copyright(c) 2016 Gregory Jacobs <greg@greg-jacobs.com>
* MIT License
*
* https://github.com/gregjacobs/Autolinker.js
*/o=[],void 0===(i="function"==typeof(r=function(){var e,t,n,r,o,i,a,s=function(e){e=e||{},this.version=s.version,this.urls=this.normalizeUrlsCfg(e.urls),this.email="boolean"!=typeof e.email||e.email,this.twitter="boolean"!=typeof e.twitter||e.twitt...
//# sourceMappingURL=swagger-ui-bundle.js.map
view all matches for this distribution
view release on metacpan or search on metacpan
xgboost/dmlc-core/src/io/s3_filesys.h view on Meta::CPAN
public:
/*! \brief destructor */
virtual ~S3FileSystem() {}
/*!
* \brief Sets AWS access credentials
* \param aws_access_id The AWS Access Key ID
* \param aws_secret_key The AWS Secret Key
* \return the information about the file
*/
void SetCredentials(const std::string& aws_access_id,
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Amazon/API.pm view on Meta::CPAN
use XML::Simple;
__PACKAGE__->follow_best_practice;
__PACKAGE__->mk_accessors(qw/action api api_methods version content_type
http_method credentials response protocol
region url service_url_base
signer target user_agent debug last_action
aws_access_key_id aws_secret_access_key token
/);
lib/Amazon/API.pm view on Meta::CPAN
new( options )
=over 5
=item credentials (required)
C<Amazon::Credentials> object or at least an object that
C<->can(get_aws_access_key_id)> and
C<->can(get_aws_secret_access_key)> and C<->can(get_token)>
lib/Amazon/API.pm view on Meta::CPAN
# note some APIs are global, hence an API may send '' to indicate global
$self->set_region('us-east-1')
unless defined $self->get_region;
unless ( $self->get_credentials ) {
$self->set_credentials( new Amazon::Credentials( { aws_secret_access_key => $self->get_aws_secret_access_key,
aws_access_key_id => $self->get_aws_access_key_id,
token => $self->get_token
})
);
}
lib/Amazon/API.pm view on Meta::CPAN
else {
die "ERROR: no url or service_url defined.\n"
}
}
$self->set_signer(AWS::Signature4->new(-access_key => $self->get_credentials->get_aws_access_key_id,
-secret_key => $self->get_credentials->get_aws_secret_access_key)
);
if ( $self->get_api_methods ) {
no strict 'refs';
lib/Amazon/API.pm view on Meta::CPAN
}
else {
$request->uri(sprintf("%s?%s", $request->uri(), $self->_finalize_content($options{content})));
}
$request->header('X-Amz-Security-Token', $self->get_credentials->get_token)
if $self->get_credentials->get_token;
# sign the request
$self->get_signer->sign($request);
# make the request, return response object
lib/Amazon/API.pm view on Meta::CPAN
Of course, creating a class for the service is optional. It may be
desirable however to create higher level and more convenient methods
that aid the developer in utilizing a particular API.
my $api = new Amazon::API({ credentials => new Amazon::Credentials, api => 'AWSEvents', url => 'https://events.us-east-1.amazonaws.com' });
$api->invoke_api('ListRules', {});
=head2 Content-Type
Yet another piece of evidence that suggests the I<organic> nature of
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Amazon/CloudFront/Thin.pm view on Meta::CPAN
Amazon CloudFront is the content-delivery (CDN) service of Amazon Web
Services (AWS). You use it by
L<< creating distributions|https://console.aws.amazon.com/cloudfront/home?region=us-east-1#distributions: >>
(each with its own "distribution id" which we use below). To manage
your distributions with this module, you need to provide credentials
allowed to access/change your CloudFront distributions. You do this
by going to L<< AWS's Identity and Access Management (IAM) console|https://console.aws.amazon.com/iam/home >>
and creating a new user. When you do that, the user's C<Access Key ID>
and C<Secret Access Key> credentials will be shown to you. You'll also
need to pass those to Amazon::CloudFront::Thin's constructor as shown
in the SYNOPSIS and below, as C<aws_access_key_id> and
C<aws_secret_access_key>, respectively. Finally, please note that
B<the provided IAM credentials must have the rights to change your CloudFront>.
You can do that by clicking on the user (in the Amazon IAM console where
you created it) and attaching a policy to it, such as the
C<CloudFrontFullAccess> standard policy. Otherwise you'll get errors when
trying to invalidate your CloudFront distributions.
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Amazon/Credentials.pm view on Meta::CPAN
use LWP::UserAgent;
use POSIX::strptime qw/strptime/;
use Time::Local;
use Scalar::Util qw/reftype/;
use constant AWS_IAM_SECURITY_CREDENTIALS_URL => 'http://169.254.169.254/latest/meta-data/iam/security-credentials/';
use constant AWS_AVAILABILITY_ZONE_URL => 'http://169.254.169.254/latest/meta-data/placement/availability-zone';
use constant AWS_CONTAINER_CREDENTIALS_URL => 'http://169.254.170.2';
use vars qw/$VERSION @EXPORT/;
lib/Amazon/Credentials.pm view on Meta::CPAN
my $aws_creds = new Amazon::Credentials({order => [qw/env file container role/]});
=head1 DESCRIPTION
Class to find AWS credentials from either the environment,
configuration files, instance meta-data or container role.
You can specify the order using the C<order> option in the constructor
to determine the order in which the class will look for credentials.
The default order is I<environent>, I<file>, I<container>, I<instance
meta-data>. See L</new>.
=head1 METHODS
lib/Amazon/Credentials.pm view on Meta::CPAN
=item aws_secret_access_key
AWS secret access key.
I<Note: If you pass the access keys in the constructor then the
constructor will not look in other places for credentials.>
=item debug
Set to true for verbose troubleshooting information.
lib/Amazon/Credentials.pm view on Meta::CPAN
only useful to override this for testing purposes.>
=item profile
The profile name in the configuration file (F<~/.aws/config> or
F<~/.aws/credentials>).
my $aws_creds = new Amazon::Credentials({ profile => 'sandbox' });
The class will also look for the environment variable C<AWS_PROFILE>,
so you can invoke your script like this:
lib/Amazon/Credentials.pm view on Meta::CPAN
$ AWS_PROFILE=sandbox my-script.pl
=item order
An array reference containing tokens that specifies the order in which the class will
search for credentials.
default: role, env, file
Example:
lib/Amazon/Credentials.pm view on Meta::CPAN
=over 5
=item env - Environment
If there exists an environment variable $AWS_PROFILE, then an attempt
will be made to retrieve credentials from the credentials file using
that profile, otherwise we'll look for these environment variables to
provide credentials.
C<AWS_ACCESS_KEY_ID>
C<AWS_SECRET_ACCESS_KEY>
C<AWS_SESSION_TOKEN>
I<Note that when you set the environment variable AWS_PROFILE, the
order essentially is overridden and we'll look in your credential
files (F<~/.aws/config>, F<~/.aws/credentials>) for your credentials.
=item file - Configuration Files
=over 10
=item ~/.aws/config
=item ~/.aws/credentials
=back
The class will attempt to find the credentials in either of these two
files. You can also specify a profile to use for looking up the
credentials by passing it into the constructor or setting in an the
environment variable C<AWS_PROFILE>. If no profile is provided, the
default credentials or the first profile found is used.
my $aws_creds = new Amazon::Credentials({ order => [qw/environment role file/] });
=item container - Task Role
If the process is running in a container, the container may have a
task role. We'll look credentials using the container metadata
service.
http://169.254.170.2$AWS_CONTAINER_CREDENTIALS_RELATIVE_URI
=item role - Instance Role
The class will use the
I<http://169.254.169.254/latest/meta-data/iam/security-credential> URL
to look for an instance role and credentials.
Keep in mind that these credentials include a token that needs to be
passed to Amazon APIs when using the credentials returned when using
instance meta-data. That token has an expiration and should be
refreshed as required.
if ( $aws_creds->is_token_expired() ) {
$aws_creds->refresh_token()
lib/Amazon/Credentials.pm view on Meta::CPAN
$self->set_region($ENV{AWS_REGION} || $self->get_default_region)
unless $self->get_region;
unless ( $self->get_aws_secret_access_key && $self->get_aws_access_key_id ) {
$self->set_credentials;
}
$self;
}
lib/Amazon/Credentials.pm view on Meta::CPAN
=cut
sub get_default_region {
my $self = shift;
# try to get credentials from instance role, but we may not be
# executing on an EC2 or container.
my $url = AWS_AVAILABILITY_ZONE_URL;
my $ua = ref($self) ? $self->get_user_agent : new LWP::UserAgent;
lib/Amazon/Credentials.pm view on Meta::CPAN
};
return $region;
}
sub set_credentials {
my $self = shift;
my $creds = shift || $self->get_ec2_credentials();
if ( $creds->{aws_secret_access_key} && $creds->{aws_access_key_id} ) {
$self->set_aws_secret_access_key($creds->{aws_secret_access_key});
$self->set_aws_access_key_id($creds->{aws_access_key_id});
$self->set_token($creds->{token});
$self->set_expiration($creds->{expiration});
}
else {
die "no credentials available\n";
}
}
=pod
=head2 get_ec2_credentials (deprecated)
=head2 find_credentidals
find_credentials( option => value, ...);
You normally don't want to use this method. It's automatically invoked
by the constructor if you don't pass in any credentials. Accepts a
hash or hash reference consisting of keys (C<order> or C<profile>) in
the same manner as the constructor.
=cut
sub get_ec2_credentials {
goto &find_credentials;
}
sub find_credentials {
my $self = shift;
my %options = ref($_[0]) ? %{$_[0]} : @_;
$options{order} = $self->get_order || [ qw/env role container file/ ];
$options{profile} = $options{profile} || $self->get_profile;
lib/Amazon/Credentials.pm view on Meta::CPAN
$creds = $self->get_creds_from_role();
last if ! $@ && $creds->{role};
};
/file/ && do {
# look for ~/.aws/config and/or .aws/credentials
use File::chdir;
use File::HomeDir;
foreach my $config ( ".aws/config", ".aws/credentials" ) {
# reset this since we have hav
my $profile_name = $options{profile};
local $CWD = home;
next unless -e $config;
open my $fh, "<$config" or die "could not open credentials file!";
my $last_profile = '';
my $profile_to_find = $profile_name;
# look for credentials...by interating through credentials file
while (<$fh>) {
chomp;
my $current_line = $_;
# once we find a profile section that matches, undef it
# ./aws/credentials uses [profile-name]
# ./aws/config uses [profile profile-name]
if (/^\s*region\s*=\s*(.*?)\s*$/ ) {
my $region = $1;
# go ahead and use this region setting IF:
lib/Amazon/Credentials.pm view on Meta::CPAN
is_token_expired( window-interval )
Returns true if the token is about to expire (or is
expired). C<window-interval> is the time in minutes before the actual
expiration time that the method should consider the token expired.
The default is 5 minutes. Amazon states that new credentials will be
available I<at least> 5 minutes before a token expires.
=cut
sub is_token_expired {
lib/Amazon/Credentials.pm view on Meta::CPAN
my $expiration_date = $self->get_expiration();
my $expired = 0;
if ( defined $expiration_date ) {
# AWS recommends getting credentials 5 minutes prior to expiration
my $g = _iso8601_to_time($expiration_date);
# shave 5 minutes or window interval off of the expiration time
$g -= $window_interval * 60;
lib/Amazon/Credentials.pm view on Meta::CPAN
IAM role if available.
=item source
Will be 'IAM' if role and credentials found.
=back
=cut
sub get_creds_from_role {
my $self = shift;
my $creds = {};
# try to get credentials from instance role
my $url = AWS_IAM_SECURITY_CREDENTIALS_URL;
my $ua = $self->get_user_agent;
my $role;
lib/Amazon/Credentials.pm view on Meta::CPAN
=pod
=head2 refresh_token
refresh_token() (deprecated)
refresh_credentials()
Retrieves a fresh set of IAM credentials.
if ( $creds->is_token_expired ) {
$creds->refresh_token()
}
=cut
sub refresh_credentials {
goto &refresh_token;
}
sub refresh_token {
my $self = shift;
lib/Amazon/Credentials.pm view on Meta::CPAN
if $self->get_debug;
die "unable to refresh token!"
unless ref($creds);
$self->set_credentials($creds);
}
sub get_creds_from_container {
my $self = shift;
my $creds = {};
if ( exists $ENV{AWS_CONTAINER_CREDENTIALS_RELATIVE_URI} ) {
# try to get credentials from instance role
my $url = sprintf("%s%s", AWS_CONTAINER_CREDENTIALS_URL, $ENV{AWS_CONTAINER_CREDENTIALS_RELATIVE_URI});
my $ua = $self->get_user_agent;
my $req = HTTP::Request->new( GET => $url );
$req->header("Accept", "*/*");
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Amazon/DynamoDB/20120810.pm view on Meta::CPAN
$req->content($payload);
$req->header( 'Content-Length' => length($payload));
if ($self->{use_iam_role}) {
my $creds = VM::EC2::Security::CredentialCache->get();
defined($creds) || die("Unable to retrieve IAM role credentials");
$self->{access_key} = $creds->accessKeyId;
$self->{secret_key} = $creds->secretAccessKey;
$req->header('x-amz-security-token' => $creds->sessionToken);
}
view all matches for this distribution