| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | package OpenID::Lite::Extension::UI::Request; | 
| 2 |  |  |  |  |  |  |  | 
| 3 | 1 |  |  | 1 |  | 451 | use Any::Moose; | 
|  | 0 |  |  |  |  |  |  | 
|  | 0 |  |  |  |  |  |  | 
| 4 |  |  |  |  |  |  | extends 'OpenID::Lite::Extension::Request'; | 
| 5 |  |  |  |  |  |  |  | 
| 6 |  |  |  |  |  |  | use OpenID::Lite::Extension::UI qw( | 
| 7 |  |  |  |  |  |  | UI_NS | 
| 8 |  |  |  |  |  |  | UI_POPUP_NS | 
| 9 |  |  |  |  |  |  | UI_LANG_NS | 
| 10 |  |  |  |  |  |  | UI_NS_ALIAS | 
| 11 |  |  |  |  |  |  | ); | 
| 12 |  |  |  |  |  |  |  | 
| 13 |  |  |  |  |  |  | has 'lang' => ( | 
| 14 |  |  |  |  |  |  | is      => 'rw', | 
| 15 |  |  |  |  |  |  | isa     => 'Str', | 
| 16 |  |  |  |  |  |  | #    default => q{en-US} | 
| 17 |  |  |  |  |  |  | ); | 
| 18 |  |  |  |  |  |  |  | 
| 19 |  |  |  |  |  |  | has 'mode' => ( | 
| 20 |  |  |  |  |  |  | is      => 'rw', | 
| 21 |  |  |  |  |  |  | isa     => 'Str', | 
| 22 |  |  |  |  |  |  | #    default => q{popup}, | 
| 23 |  |  |  |  |  |  | ); | 
| 24 |  |  |  |  |  |  |  | 
| 25 |  |  |  |  |  |  | # RP should create popup to be 450 pixels wide and 500 pixels tall. | 
| 26 |  |  |  |  |  |  | # The popup must have the address bar displayed. | 
| 27 |  |  |  |  |  |  | # The popup must be in a standalone browser window. | 
| 28 |  |  |  |  |  |  | # The contents of the popup must not be framed by the RP. | 
| 29 |  |  |  |  |  |  | override 'append_to_params' => sub { | 
| 30 |  |  |  |  |  |  | my ( $self, $params ) = @_; | 
| 31 |  |  |  |  |  |  | $params->register_extension_namespace( UI_NS_ALIAS, UI_NS ); | 
| 32 |  |  |  |  |  |  | $params->set_extension( UI_NS_ALIAS, 'lang', $self->lang ); | 
| 33 |  |  |  |  |  |  | $params->set_extension( UI_NS_ALIAS, 'mode', $self->mode ); | 
| 34 |  |  |  |  |  |  | }; | 
| 35 |  |  |  |  |  |  |  | 
| 36 |  |  |  |  |  |  | sub from_provider_response { | 
| 37 |  |  |  |  |  |  | my ( $class, $res ) = @_; | 
| 38 |  |  |  |  |  |  | my $message = $res->req_params->copy(); | 
| 39 |  |  |  |  |  |  | my $ns_url  = UI_NS; | 
| 40 |  |  |  |  |  |  | my $alias   = $message->get_ns_alias($ns_url); | 
| 41 |  |  |  |  |  |  | return unless $alias; | 
| 42 |  |  |  |  |  |  | my $data = $message->get_extension_args($alias) || {}; | 
| 43 |  |  |  |  |  |  | my $obj = $class->new(); | 
| 44 |  |  |  |  |  |  | my $result = $obj->parse_extension_args($data); | 
| 45 |  |  |  |  |  |  | return $result ? $obj : undef; | 
| 46 |  |  |  |  |  |  | } | 
| 47 |  |  |  |  |  |  |  | 
| 48 |  |  |  |  |  |  | sub parse_extension_args { | 
| 49 |  |  |  |  |  |  | my ( $self, $args ) = @_; | 
| 50 |  |  |  |  |  |  | $self->lang( $args->{lang} ) if $args->{lang}; | 
| 51 |  |  |  |  |  |  | $self->mode( $args->{mode} ) if $args->{mode}; | 
| 52 |  |  |  |  |  |  | return 1; | 
| 53 |  |  |  |  |  |  | } | 
| 54 |  |  |  |  |  |  |  | 
| 55 |  |  |  |  |  |  | no Any::Moose; | 
| 56 |  |  |  |  |  |  | __PACKAGE__->meta->make_immutable; | 
| 57 |  |  |  |  |  |  | 1; |