| 1 | package OpenID::Lite::SessionHandler::NoEncryption; | ||||||||||
| 2 | |||||||||||
| 3 | 1 | ▶ | use Any::Moose; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 1 | extends 'OpenID::Lite::SessionHandler'; | |||||||||
| 5 | |||||||||||
| 6 | 1 | ▶ | use MIME::Base64 (); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | |||||||||||
| 8 | 1 | ▶ | use OpenID::Lite::Constants::AssocType qw(HMAC_SHA1 HMAC_SHA256); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | 1 | ▶ | use OpenID::Lite::Constants::SessionType qw(NO_ENCRYPTION); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 10 | |||||||||||
| 11 | 1 | has '+_session_type' => ( | |||||||||
| 12 | default => NO_ENCRYPTION, | ||||||||||
| 13 | ); | ||||||||||
| 14 | |||||||||||
| 15 | has '+_allowed_assoc_types' => ( | ||||||||||
| 16 | 0 | ▶ | default => sub { [ HMAC_SHA1, HMAC_SHA256 ] }, | ||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||
| 17 | 1 | ); | |||||||||
| 18 | |||||||||||
| 19 | 0 | ▶ | override 'set_request_params' => sub { | ||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||
| 20 | 0 | my ( $self, $service, $params ) = @_; | |||||||||
| 21 | 0 | ▶ | unless ( $service->requires_compatibility_mode ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 22 | 0 | $params->set( session_type => $self->_session_type ); | |||||||||
| 23 | } | ||||||||||
| 24 | 0 | return $params; | |||||||||
| 25 | 1 | }; | |||||||||
| 26 | |||||||||||
| 27 | 0 | ▶ | override 'set_response_params' => sub { | ||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||
| 28 | 0 | my ( $self, $req_params, $res_params, $association ) = @_; | |||||||||
| 29 | 0 | my $secret = MIME::Base64::encode_base64( $association->secret ); | |||||||||
| 30 | 0 | $secret =~ s/\s+//g; | |||||||||
| 31 | 0 | $res_params->set( mac_key => $secret ); | |||||||||
| 32 | |||||||||||
| 33 | 0 | ▶ | unless ( $res_params->is_openid1 ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 34 | 0 | $res_params->set( session_type => $self->_session_type ); | |||||||||
| 35 | } | ||||||||||
| 36 | 1 | }; | |||||||||
| 37 | |||||||||||
| 38 | 0 | ▶ | override 'extract_secret' => sub { | ||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||
| 39 | 0 | my ( $self, $params ) = @_; | |||||||||
| 40 | 0 | ▶ | my $mac_key = $params->get('mac_key') | ||||||||
|
Branch: 1 branch
| |||||||||||
| 41 | or return $self->ERROR(q{Missing parameter, "mac_key".}); | ||||||||||
| 42 | 0 | return MIME::Base64::decode_base64( $mac_key ); | |||||||||
| 43 | 1 | }; | |||||||||
| 44 | |||||||||||
| 45 | 1 | ▶ | no Any::Moose; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 46 | 1 | __PACKAGE__->meta->make_immutable; | |||||||||
| 47 | 1 | 1; | |||||||||
| 48 | |||||||||||