| 1 | package VM::EC2::Security::FederatedUser; | ||
| 2 | |||
| 3 | =head1 NAME | ||
| 4 | |||
| 5 | VM::EC2::Security::FederatedUser -- Federated user object | ||
| 6 | |||
| 7 | =head1 SYNOPSIS | ||
| 8 | |||
| 9 | use VM::EC2; | ||
| 10 | use VM::EC2::Security::Policy; | ||
| 11 | |||
| 12 | # on your side of the connection | ||
| 13 | $ec2 = VM::EC2->new(...); # as usual | ||
| 14 | my $policy = VM::EC2::Security::Policy->new; | ||
| 15 | $policy->allow('DescribeImages','RunInstances'); | ||
| 16 | |||
| 17 | my $token = $ec2->get_federation_token(-name => 'TemporaryUser', | ||
| 18 | -duration => 60*60*3, # 3 hrs, as seconds | ||
| 19 | -policy => $policy); | ||
| 20 | |||
| 21 | my $user = $token->federated_user; | ||
| 22 | print $user->arn,"\n"; | ||
| 23 | print $user->federated_user_id,"\n"; | ||
| 24 | |||
| 25 | =head1 DESCRIPTION | ||
| 26 | |||
| 27 | This object forms part of the VM::EC2::Security::Token object, which | ||
| 28 | is created when you need to grant temporary access to some or all of | ||
| 29 | your AWS resources to someone who does not have an AWS account. | ||
| 30 | |||
| 31 | =head1 METHODS | ||
| 32 | |||
| 33 | arn() -- Return the Amazon Resource Name unique identifier (ARN) | ||
| 34 | associated with the temporary user, e.g. | ||
| 35 | arn:aws:sts::123451234512345:federated-user/fred | ||
| 36 | |||
| 37 | federatedUserId() -- Return the user ID for this temporary user, e.g. | ||
| 38 | 123451234512345:fred | ||
| 39 | |||
| 40 | =head1 STRING OVERLOADING | ||
| 41 | |||
| 42 | When used in a string context, this object will interpolate as the | ||
| 43 | ARN. | ||
| 44 | |||
| 45 | =head1 SEE ALSO | ||
| 46 | |||
| 47 | L<VM::EC2> | ||
| 48 | L<VM::EC2::Generic> | ||
| 49 | |||
| 50 | =head1 AUTHOR | ||
| 51 | |||
| 52 | Lincoln Stein E<lt>lincoln.stein@gmail.comE<gt>. | ||
| 53 | |||
| 54 | Copyright (c) 2011 Ontario Institute for Cancer Research | ||
| 55 | |||
| 56 | This package and its accompanying libraries is free software; you can | ||
| 57 | redistribute it and/or modify it under the terms of the GPL (either | ||
| 58 | version 1, or at your option, any later version) or the Artistic | ||
| 59 | License 2.0. Refer to LICENSE for the full license text. In addition, | ||
| 60 | please see DISCLAIMER.txt for disclaimers of warranty. | ||
| 61 | |||
| 62 | =cut | ||
| 63 | |||
| 64 | use strict; | ||
| 65 | use base 'VM::EC2::Generic'; | ||
| 66 | |||
| 67 | sub valid_fields { | ||
| 68 | my $self = shift; | ||
| 69 | return qw(Arn FederatedUserId); | ||
| 70 | } | ||
| 71 | |||
| 72 | sub short_name {shift->arn} | ||
| 73 | |||
| 74 | 1; |