zxid

 view release on metacpan or  search on metacpan

mockpdp.pl  view on Meta::CPAN


### Actual policy evaluation

$perm = $$xx{'user'}{$role}{'aspect'}{$resource}{'right'};
warn "perm($perm) from role($role) resource($resource) action($action)";

if ($perm eq 'no' || !length $perm) {
    $decision = 'Deny';
} elsif ($action eq $perm) {
    $decision = 'Permit';
} else {
    $decision = 'Deny';
}

### Response

$instant  = datetime(time);
$notafter = datetime(time+3*3600);
$id = rand(10000);

print <<SOAP;
Content-type: text/plain

<e:Envelope xmlns:e="http://schemas.xmlsoap.org/soap/envelope/">
<e:Header></e:Header>
<e:Body>
<sp:Response xmlns:sp="urn:oasis:names:tc:SAML:2.0:protocol"
    ID="R$id" IssueInstant="$instant" Version="2.0">
<sa:Issuer xmlns:sa="urn:oasis:names:tc:SAML:2.0:assertion">$issuer</sa:Issuer>

<sp:Status>
<sp:StatusCode Value="urn:oasis:names:tc:SAML:2.0:status:Success"></sp:StatusCode>
</sp:Status>

<sa:Assertion xmlns:sa="urn:oasis:names:tc:SAML:2.0:assertion"
    ID="A$id" IssueInstant="$instant" Version="2.0">
<sa:Issuer>$issuer</sa:Issuer>
<sa:Conditions NotBefore="$instant" NotOnOrAfter="$notafter"></sa:Conditions>
<xasa:XACMLAuthzDecisionStatement xmlns:xasa="urn:oasis:xacml:2.0:saml:assertion:schema:os">
<xac:Response xmlns:xac="urn:oasis:names:tc:xacml:2.0:context:schema:os">
<xac:Result>
<xac:Decision>$decision</xac:Decision>
<xac:Status>
<xac:StatusCode Value="urn:oasis:names:tc:xacml:1.0:status:ok"></xac:StatusCode>
</xac:Status>
</xac:Result>
</xac:Response>
</xasa:XACMLAuthzDecisionStatement>
</sa:Assertion>

</sp:Response>
</e:Body>
</e:Envelope>
SOAP
    ;

__END__

Example (azrq1):

<e:Envelope xmlns:e="http://schemas.xmlsoap.org/soap/envelope/"><e:Body><xasp:XACMLAuthzDecisionQuery xmlns:xasp="urn:oasis:xacml:2.0:saml:protocol:schema:os" ID="RmQtc_SvgPVYANCPrELYfjl59" IssueInstant="2009-12-19T11:33:54Z" Version="2.0"><sa:Issuer...

Example (azrs1):

<e:Envelope xmlns:e="http://schemas.xmlsoap.org/soap/envelope/">
<e:Header></e:Header>
<e:Body>
<sp:Response xmlns:sp="urn:oasis:names:tc:SAML:2.0:protocol" ID="R3yhGlzrJ_DCeoYj_apS773FQ" IssueInstant="2009-12-19T11:33:55Z" Version="2.0">
<sa:Issuer xmlns:sa="urn:oasis:names:tc:SAML:2.0:assertion">http://idp.tas3.pt:8081/zxididp?o=B</sa:Issuer>
<ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
<ds:SignedInfo>
<ds:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"></ds:CanonicalizationMethod>
<ds:SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"></ds:SignatureMethod>
<ds:Reference URI="#R3yhGlzrJ_DCeoYj_apS773FQ">
<ds:Transforms>
<ds:Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"></ds:Transform>
<ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"></ds:Transform>
</ds:Transforms>
<ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></ds:DigestMethod>
<ds:DigestValue>B+Mu8P4wXvV8EjW64gzpMN2vFio=</ds:DigestValue>
</ds:Reference>
</ds:SignedInfo>
<ds:SignatureValue>iZJxULLrSbdVmcRg5cqwBfNDs0bpWkRNYyJqFsfeq9TB3styJW2YpdajbFX/GF996ERN1RiQam7T+mkGaa10eBCRaPrf4RWdEPgk6toiwjObWxQxLoN1VPbiOoaeCXKqkYklC25cwnVzmp9PzE4cNvOpowWHc/px+JN4P7OxVpw=</ds:SignatureValue>
</ds:Signature>
<sp:Status>
<sp:StatusCode Value="urn:oasis:names:tc:SAML:2.0:status:Success"></sp:StatusCode>
</sp:Status>

<sa:Assertion xmlns:sa="urn:oasis:names:tc:SAML:2.0:assertion" ID="A1aRci5gH7kAiQB9xFFRhwwhf" IssueInstant="2009-12-19T11:33:55Z" Version="2.0">
<sa:Issuer>http://idp.tas3.pt:8081/zxididp?o=B</sa:Issuer>
<sa:Conditions NotBefore="2009-12-19T11:33:55Z" NotOnOrAfter="2009-12-19T12:33:55Z"></sa:Conditions>
<xasa:XACMLAuthzDecisionStatement xmlns:xasa="urn:oasis:xacml:2.0:saml:assertion:schema:os">
<xac:Response xmlns:xac="urn:oasis:names:tc:xacml:2.0:context:schema:os">
<xac:Result>
<xac:Decision>Permit</xac:Decision>
<xac:Status>
<xac:StatusCode Value="urn:oasis:names:tc:xacml:1.0:status:ok"></xac:StatusCode>
</xac:Status>
</xac:Result>
</xac:Response>
</xasa:XACMLAuthzDecisionStatement>
</sa:Assertion>

</sp:Response>
</e:Body>
</e:Envelope>


<e:Envelope xmlns:e="http://schemas.xmlsoap.org/soap/envelope/"><e:Header></e:Header><e:Body><sp:Response xmlns:sp="urn:oasis:names:tc:SAML:2.0:protocol" ID="R3yhGlzrJ_DCeoYj_apS773FQ" IssueInstant="2009-12-19T11:33:55Z" Version="2.0"><sa:Issuer xmln...

<authority>
<user name="user1">
<aspect name="Competency" right="display"/>
<aspect name="Interests" right="display"/>
<aspect name="Demographics" right="display"/>
<aspect name="Product" right="no"/>
<aspect name="Address" right="no"/>
<aspect name="Affiliations" right="no"/>
<aspect name="ContactInfo" right="no"/>
</user>
<user name="user2">
<aspect name="Competency" right="display"/>
<aspect name="Interests" right="display"/>
</user>
</authority>



( run in 0.508 second using v1.01-cache-2.11-cpan-71847e10f99 )