aboutsummaryrefslogtreecommitdiff
path: root/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/pvp2x/verification/EntityVerifier.java
diff options
context:
space:
mode:
authorAndreas Fitzek <andreas.fitzek@iaik.tugraz.at>2013-07-08 13:32:23 +0200
committerAndreas Fitzek <andreas.fitzek@iaik.tugraz.at>2013-07-08 13:32:23 +0200
commit3f9891a9198619568c82220b706a445217335065 (patch)
treef808621885827a38007460601ae32475ab7c1eea /id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/pvp2x/verification/EntityVerifier.java
parent206f283585a28009bb8276f78e7ea1d95298fd8c (diff)
parent4ebecf480d17550d93165ab17c249cd2caed9e5b (diff)
downloadmoa-id-spss-3f9891a9198619568c82220b706a445217335065.tar.gz
moa-id-spss-3f9891a9198619568c82220b706a445217335065.tar.bz2
moa-id-spss-3f9891a9198619568c82220b706a445217335065.zip
Merge PVP2 and MOA 2.0
Diffstat (limited to 'id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/pvp2x/verification/EntityVerifier.java')
-rw-r--r--id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/pvp2x/verification/EntityVerifier.java34
1 files changed, 16 insertions, 18 deletions
diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/pvp2x/verification/EntityVerifier.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/pvp2x/verification/EntityVerifier.java
index 41e9b70cf..d3acf9351 100644
--- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/pvp2x/verification/EntityVerifier.java
+++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/pvp2x/verification/EntityVerifier.java
@@ -8,65 +8,63 @@ import org.opensaml.xml.signature.SignatureValidator;
import org.opensaml.xml.validation.ValidationException;
import at.gv.egovernment.moa.id.MOAIDException;
-import at.gv.egovernment.moa.id.protocols.pvp2x.SAMLRequestNotSignedException;
+import at.gv.egovernment.moa.id.protocols.pvp2x.exceptions.NoCredentialsException;
+import at.gv.egovernment.moa.id.protocols.pvp2x.exceptions.SAMLRequestNotSignedException;
import at.gv.egovernment.moa.id.protocols.pvp2x.signer.CredentialProvider;
+import at.gv.egovernment.moa.logging.Logger;
public class EntityVerifier {
public static void verify(EntityDescriptor entityDescriptor) throws MOAIDException {
if (entityDescriptor.getSignature() == null) {
- throw new SAMLRequestNotSignedException("NOT SIGNED",
- new Object[] {});
+ throw new SAMLRequestNotSignedException();
}
try {
SAMLSignatureProfileValidator sigValidator = new SAMLSignatureProfileValidator();
sigValidator.validate(entityDescriptor.getSignature());
} catch (ValidationException e) {
- e.printStackTrace();
- throw new MOAIDException("SIGNATURE VALIDATOR", new Object[] {});
+ Logger.error("Failed to validate Signature", e);
+ throw new SAMLRequestNotSignedException(e);
}
Credential credential = CredentialProvider.getSPTrustedCredential(entityDescriptor.getEntityID());
if(credential == null) {
- throw new MOAIDException("NO CREDENTIALS FOR " + entityDescriptor.getEntityID(), new Object[] {});
+ throw new NoCredentialsException(entityDescriptor.getEntityID());
}
SignatureValidator sigValidator = new SignatureValidator(credential);
try {
sigValidator.validate(entityDescriptor.getSignature());
} catch (ValidationException e) {
- // Indicates signature was not cryptographically valid, or possibly a processing error
- e.printStackTrace();
- throw new MOAIDException("FAILED TO VERIFY SIGNATURE", new Object[] {});
+ Logger.error("Failed to verfiy Signature", e);
+ throw new SAMLRequestNotSignedException(e);
}
}
public static void verify(EntitiesDescriptor entityDescriptor) throws MOAIDException {
if (entityDescriptor.getSignature() == null) {
- throw new SAMLRequestNotSignedException("NOT SIGNED",
- new Object[] {});
+ throw new SAMLRequestNotSignedException();
}
try {
SAMLSignatureProfileValidator sigValidator = new SAMLSignatureProfileValidator();
sigValidator.validate(entityDescriptor.getSignature());
} catch (ValidationException e) {
- e.printStackTrace();
- throw new MOAIDException("SIGNATURE VALIDATOR", new Object[] {});
+ Logger.error("Failed to validate Signature", e);
+ throw new SAMLRequestNotSignedException(e);
}
- Credential credential = CredentialProvider.getTrustedCredential();
+ Credential credential = CredentialProvider.getSPTrustedCredential(entityDescriptor.getName());
if(credential == null) {
- throw new MOAIDException("NO CREDENTIALS FOR ", new Object[] {});
+ throw new NoCredentialsException("moaID IDP");
}
SignatureValidator sigValidator = new SignatureValidator(credential);
try {
sigValidator.validate(entityDescriptor.getSignature());
} catch (ValidationException e) {
- // Indicates signature was not cryptographically valid, or possibly a processing error
- e.printStackTrace();
- throw new MOAIDException("FAILED TO VERIFY SIGNATURE", new Object[] {});
+ Logger.error("Failed to verfiy Signature", e);
+ throw new SAMLRequestNotSignedException(e);
}
}