diff options
author | Andreas Fitzek <andreas.fitzek@iaik.tugraz.at> | 2013-06-05 10:51:23 +0200 |
---|---|---|
committer | Andreas Fitzek <andreas.fitzek@iaik.tugraz.at> | 2013-06-05 10:51:23 +0200 |
commit | bdc7311ce86c6d39c3ff96b38c33b36ee6a28d1d (patch) | |
tree | 4f72690ba50d39b68f7e692ff2d1cad28f8d87f1 /id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/pvp2x/validation/SAMLSignatureValidator.java | |
parent | 7489cb6721d99d997679fc7905f40acb7b296e98 (diff) | |
download | moa-id-spss-bdc7311ce86c6d39c3ff96b38c33b36ee6a28d1d.tar.gz moa-id-spss-bdc7311ce86c6d39c3ff96b38c33b36ee6a28d1d.tar.bz2 moa-id-spss-bdc7311ce86c6d39c3ff96b38c33b36ee6a28d1d.zip |
SAML Attribute Constants, Dynamic Attribute building system, Take metadata attributes into account for authnResponse
Diffstat (limited to 'id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/pvp2x/validation/SAMLSignatureValidator.java')
-rw-r--r-- | id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/pvp2x/validation/SAMLSignatureValidator.java | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/pvp2x/validation/SAMLSignatureValidator.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/pvp2x/validation/SAMLSignatureValidator.java index 95c548389..df0fec001 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/pvp2x/validation/SAMLSignatureValidator.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/pvp2x/validation/SAMLSignatureValidator.java @@ -1,5 +1,6 @@ package at.gv.egovernment.moa.id.protocols.pvp2x.validation; +import org.opensaml.common.SignableSAMLObject; import org.opensaml.saml2.core.RequestAbstractType; import org.opensaml.security.SAMLSignatureProfileValidator; import org.opensaml.xml.validation.ValidationException; @@ -11,10 +12,11 @@ public class SAMLSignatureValidator implements ISAMLValidator { public void validateRequest(RequestAbstractType request) throws MOAIDException { - if(request.getSignature() == null) { - throw new SAMLRequestNotSignedException("NOT SIGNED", new Object[] {}); + if (request.getSignature() == null) { + throw new SAMLRequestNotSignedException("NOT SIGNED", + new Object[] {}); } - + try { SAMLSignatureProfileValidator sigValidator = new SAMLSignatureProfileValidator(); sigValidator.validate(request.getSignature()); @@ -24,4 +26,19 @@ public class SAMLSignatureValidator implements ISAMLValidator { } } + public static void validateSignable(SignableSAMLObject signableObject) + throws MOAIDException { + if (signableObject.getSignature() == null) { + throw new SAMLRequestNotSignedException("NOT SIGNED", + new Object[] {}); + } + + try { + SAMLSignatureProfileValidator sigValidator = new SAMLSignatureProfileValidator(); + sigValidator.validate(signableObject.getSignature()); + } catch (ValidationException e) { + e.printStackTrace(); + throw new MOAIDException("SIGNATURE VALIDATOR", new Object[] {}); + } + } } |