From fce4c57294d23745298344d62c5ef28d01f06eb5 Mon Sep 17 00:00:00 2001 From: srasmusson Date: Sat, 23 Apr 2016 23:34:38 +0200 Subject: [PATCH] Changing EntityIdCriteria to EntityIdCriterion when resolving credential --- .idea/workspace.xml | 95 ++++++++++++------- .../steras/opensamlbook/sp/AccessFilter.java | 5 +- .../steras/opensamlbook/sp/SPCredentials.java | 14 ++- 3 files changed, 73 insertions(+), 41 deletions(-) diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 773dd6d..f2d8780 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,12 +2,7 @@ - - - - - @@ -30,11 +25,11 @@ - + - - + + @@ -62,12 +57,17 @@ - + - - - + + + + + + + + @@ -150,8 +150,8 @@ @@ -504,7 +504,12 @@ - + + + + + + @@ -586,7 +591,12 @@ - + + + + + + @@ -668,7 +678,12 @@ - + + + + + + @@ -750,7 +765,12 @@ - + + + + + + @@ -865,14 +885,6 @@ - - - - - - - - @@ -881,23 +893,36 @@ - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/main/java/no/steras/opensamlbook/sp/AccessFilter.java b/src/main/java/no/steras/opensamlbook/sp/AccessFilter.java index 5476a24..3075d5b 100644 --- a/src/main/java/no/steras/opensamlbook/sp/AccessFilter.java +++ b/src/main/java/no/steras/opensamlbook/sp/AccessFilter.java @@ -96,7 +96,10 @@ public class AccessFilter implements Filter { SAMLEndpointContext endpointContext = peerEntityContext.getSubcontext(SAMLEndpointContext.class, true); endpointContext.setEndpoint(getIPDEndpoint()); - + SignatureSigningParameters signatureSigningParameters = new SignatureSigningParameters(); + signatureSigningParameters.setSigningCredential(SPCredentials.getCredential()); + context.getSubcontext(SecurityParametersContext.class, true).setSignatureSigningParameters(); + context.setMessage(authnRequest); diff --git a/src/main/java/no/steras/opensamlbook/sp/SPCredentials.java b/src/main/java/no/steras/opensamlbook/sp/SPCredentials.java index d2ad05f..8b1a083 100644 --- a/src/main/java/no/steras/opensamlbook/sp/SPCredentials.java +++ b/src/main/java/no/steras/opensamlbook/sp/SPCredentials.java @@ -1,6 +1,9 @@ package no.steras.opensamlbook.sp; import net.shibboleth.utilities.java.support.resolver.CriteriaSet; +import net.shibboleth.utilities.java.support.resolver.Criterion; +import net.shibboleth.utilities.java.support.resolver.ResolverException; +import org.opensaml.core.criterion.EntityIdCriterion; import org.opensaml.security.credential.Credential; import org.opensaml.security.credential.impl.KeyStoreCredentialResolver; import org.slf4j.Logger; @@ -18,7 +21,7 @@ import java.util.Map; * Created by Privat on 13/05/14. */ public class SPCredentials { -/* private static final String KEY_STORE_PASSWORD = "password"; + private static final String KEY_STORE_PASSWORD = "password"; private static final String KEY_STORE_ENTRY_PASSWORD = "password"; private static final String KEY_STORE_PATH = "/SPKeystore.jks"; private static final String KEY_ENTRY_ID = "SPKey"; @@ -32,11 +35,12 @@ public class SPCredentials { passwordMap.put(KEY_ENTRY_ID, KEY_STORE_ENTRY_PASSWORD); KeyStoreCredentialResolver resolver = new KeyStoreCredentialResolver(keystore, passwordMap); - Criteria criteria = new EntityIDCriteria(KEY_ENTRY_ID); - CriteriaSet criteriaSet = new CriteriaSet(criteria); + Criterion criterion = new EntityIdCriterion(KEY_ENTRY_ID); + CriteriaSet criteriaSet = new CriteriaSet(); credential = resolver.resolveSingle(criteriaSet); - } catch (org.opensaml.xml.security.SecurityException e) { + + } catch (ResolverException e) { throw new RuntimeException("Something went wrong reading credentials", e); } } @@ -57,5 +61,5 @@ public class SPCredentials { return credential; } - */ + }