| 1 | # Copyrights 2012-2016 by [Mark Overmeer]. | ||||||||||||
| 2 | # For other contributors see ChangeLog. | ||||||||||||
| 3 | # See the manual pages for details on the licensing terms. | ||||||||||||
| 4 | # Pod stripped from pm file by OODoc 2.02. | ||||||||||||
| 5 | 5 | ▶ | use warnings; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 6 | 5 | ▶ | use strict; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 7 | |||||||||||||
| 8 | package XML::Compile::WSS::SecToken; | ||||||||||||
| 9 | 5 | ▶ | use vars '$VERSION'; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 10 | 5 | $VERSION = '2.02'; | |||||||||||
| 11 | |||||||||||||
| 12 | |||||||||||||
| 13 | 5 | ▶ | use Log::Report 'xml-compile-wss-sig'; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 14 | |||||||||||||
| 15 | 5 | ▶ | use XML::Compile::WSS::Util qw/XTP10_X509v3 WSU_10 :wsm10 :wsm11 XENC_NS/; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 16 | 5 | ▶ | use Scalar::Util qw/blessed/; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 17 | |||||||||||||
| 18 | |||||||||||||
| 19 | sub new(@) | ||||||||||||
| 20 | 6 | ▶ | { my $class = shift; | ||||||||||
|
Subroutine
new: called CC=6 SCAR=24.8
Pod
documented
| |||||||||||||
| 21 | 6 | ▶ | my $args = @_==1 ? shift : {@_}; | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 22 | 6 | ▶ | my $type = delete $args->{type} || XTP10_X509v3; | ||||||||||
|
Condition100%2/2
delete $args->{'type'} || 'http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509v3'
MC/DC100%1/1
delete $args->{'type'} || 'http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509v3'
delete $args->{'type'}
Truth table100%2/2
A
A= delete $args->{'type'}
| |||||||||||||
| 23 | 6 | ▶ | if($class eq __PACKAGE__) | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 24 | 0 | ▶ | { if($type =~ /509/) | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 25 | 0 | { $class = 'XML::Compile::WSS::SecToken::X509v3'; | |||||||||||
| 26 | } | ||||||||||||
| 27 | else | ||||||||||||
| 28 | 0 | { error __x"security token type {type} not (yet) supported" | |||||||||||
| 29 | , type => $type; | ||||||||||||
| 30 | } | ||||||||||||
| 31 | 0 | ▶ | eval "require $class"; panic $@ if $@; | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 32 | } | ||||||||||||
| 33 | 6 | (bless {XCWS_type => $type}, $class)->init($args); | |||||||||||
| 34 | } | ||||||||||||
| 35 | |||||||||||||
| 36 | sub init($) | ||||||||||||
| 37 | 6 | ▶ | { my ($self, $args) = @_; | ||||||||||
|
Subroutine
init: called CC=4 SCAR=13.9
Pod
undocumented
| |||||||||||||
| 38 | 6 | ▶ | $self->{XCWS_id} = $args->{id} || 'my-token'; | ||||||||||
|
Condition100%2/2
$args->{'id'} || 'my-token'
MC/DC100%1/1
$args->{'id'} || 'my-token'
$args->{'id'}
Truth table100%2/2
A
A= $args->{'id'}
| |||||||||||||
| 39 | 6 | ▶ | $self->{XCWS_enc} = $args->{encoding} || WSM10_BASE64; | ||||||||||
|
Condition50%1/2
$args->{'encoding'} || 'http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary'
MC/DC0%0/1
$args->{'encoding'} || 'http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary'
$args->{'encoding'}
Truth table50%1/2
A
A= $args->{'encoding'}
| |||||||||||||
| 40 | 6 | $self->{XCWS_fp} = $args->{fingerprint}; | |||||||||||
| 41 | 6 | ▶ | $self->{XCWS_uri} = $args->{uri} || '#TOKEN-'.($self+0); | ||||||||||
|
Condition100%2/2
$args->{'uri'} || '#TOKEN-' . ($self + 0)
MC/DC100%1/1
$args->{'uri'} || '#TOKEN-' . ($self + 0)
$args->{'uri'}
Truth table100%2/2
A
A= $args->{'uri'}
| |||||||||||||
| 42 | 6 | $self->{XCWS_name} = $args->{name}; | |||||||||||
| 43 | 6 | $self; | |||||||||||
| 44 | } | ||||||||||||
| 45 | |||||||||||||
| 46 | |||||||||||||
| 47 | sub fromConfig($%) | ||||||||||||
| 48 | 0 | ▶ | { my ($class, $config, %args) = @_; | ||||||||||
|
Subroutine
fromConfig: not called CC=6 SCAR=37.4
Pod
documented
| |||||||||||||
| 49 | 0 | ▶ | $args{type} ||= XTP10_X509v3; | ||||||||||
|
Condition0%0/2
$args{"type"} ||= "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509v3"
MC/DC0%0/1
$args{"type"} ||= "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509v3"
$args{"type"}
Truth table0%0/2
A
A= $args{"type"}
| |||||||||||||
| 50 | |||||||||||||
| 51 | 0 | ▶ | return $class->new(%$config, %args) | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 52 | if ref $config eq 'HASH'; | ||||||||||||
| 53 | |||||||||||||
| 54 | 0 | ▶ | blessed $config | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 55 | or panic "token configuration requires HASH or OBJECT."; | ||||||||||||
| 56 | |||||||||||||
| 57 | 0 | ▶ | return $config | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 58 | if $config->isa(__PACKAGE__); | ||||||||||||
| 59 | |||||||||||||
| 60 | 0 | ▶ | return $class->new(%args, certificate => $config) | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 61 | if ref $config =~ m/::X509/; # there are a few options here | ||||||||||||
| 62 | |||||||||||||
| 63 | 0 | panic "token configuration `$config' not recognized"; | |||||||||||
| 64 | } | ||||||||||||
| 65 | |||||||||||||
| 66 | #----------------- | ||||||||||||
| 67 | |||||||||||||
| 68 | 0 | ▶ | sub id() {shift->{XCWS_id}} | ||||||||||
|
Subroutine
id: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||
| 69 | 2 | ▶ | sub type() {shift->{XCWS_type}} | ||||||||||
|
Subroutine
type: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||
| 70 | 0 | ▶ | sub encoding() {shift->{XCWS_enc}} | ||||||||||
|
Subroutine
encoding: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||
| 71 | |||||||||||||
| 72 | 6 | ▶ | sub fingerprint{shift->{XCWS_fp}} | ||||||||||
|
Subroutine
fingerprint: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||
| 73 | 2 | ▶ | sub uri() {shift->{XCWS_uri}} | ||||||||||
|
Subroutine
uri: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||
| 74 | 4 | ▶ | sub name() {shift->{XCWS_name}} | ||||||||||
|
Subroutine
name: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||
| 75 | |||||||||||||
| 76 | #----------------- | ||||||||||||
| 77 | |||||||||||||
| 78 | 5 | 1; | |||||||||||
| 79 | |||||||||||||
| 80 | __END__ | ||||||||||||