Problems with SAML authentication

1,240 views
Skip to first unread message

Eric Blanc

unread,
Oct 4, 2019, 7:24:07 AM10/4/19
to cBioPortal for Cancer Genomics Discussion Group
Hi,

I am trying to setup a portal instance that uses SAML authentication (obtained from OneLogin). The portal & the session server both run fine without authentication, but the connection to the portal fails with error 500 (full message attached), caused by:

org.opensaml.common.SAMLRuntimeException: Can't obtain SP signing key
org.opensaml.xml.security.SecurityException: Could not retrieve entry from keystore
java.security.UnrecoverableKeyException: Cannot recover key

The portal.properties section relevant to SAML reads:

saml.sp.metadata.entityid=cbioportal
saml.idp.metadata.location=classpath:/onelogin_metadata_nnnnnn.xml
saml.idp.metadata.entityid=https://app.onelogin.com/saml/metadata/nnnnnn
# saml keystore settings:
saml.keystore.location=classpath:/samlKeystore.jks
saml.keystore.password=xxx...xxx
saml.keystore.private-key.key=secure-key
saml.keystore.private-key.password=yyy...yyy
saml.keystore.default-key=secure-key
# How to send SAML request messages to the IDP.
# Set to "specificBinding" to configure specific binding:
saml.idp.comm.binding.settings=defaultBinding
# Configure the specific binding if above is specificBinding. Leave empty if defaultBinding.
# Options: bindings:HTTP-POST, bindings:HTTP-Redirect, bindings:PAOS, profiles:holder-of-key:SSO:browser
saml.idp.comm.binding.type=
# Change this to configure your custom UserDetails parser (default: org.cbioportal.security.spring.authentication.saml.SAMLUserDetailsServiceImpl)
saml.custom.userservice.class=org.cbioportal.security.spring.authentication.saml.SAMLUserDetailsServiceImpl
# Change this to configure to configure a custom logout URL: (default: /login.jsp?logout_success=true)
saml.logout.url=/login.jsp?logout_success=true

The portal properties, onelogin metadata & keystore files are all in $PORTAL_HOME/target/tomcat.8081/webapps/expanded/WEB-INF/classes

I am not sure whether the problem is that the keystore or onelogin metadata cannot be found, and if it is the case, where should I put them, and how should I set the locations in the portal properties.

Thanks very much for your help,
Best,
Eric

Error_500.txt

Benjamin Gross

unread,
Oct 4, 2019, 2:09:44 PM10/4/19
to Eric Blanc, cBioPortal for Cancer Genomics Discussion Group
Hi Eric,

Based on the information you provided, it sounds like samlKeystore.jks is not in your classpath.  Did you following the “Create a signing key for cBioPortal” setup?


Regards,
Benjamin

--
You received this message because you are subscribed to the Google Groups "cBioPortal for Cancer Genomics Discussion Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cbioportal+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/cbioportal/d560baac-2aa8-42a2-adce-0df0cb16be8a%40googlegroups.com.
Error_500.txt

Eric Blanc

unread,
Oct 4, 2019, 2:14:30 PM10/4/19
to cBioPortal for Cancer Genomics Discussion Group
Hi Benjamin,

Thanks for your reply.

I have created the keystore, but I just put the file in the WEB-INF/classes, not re-created a war file. Should I re-create one?

Regards,
Eric

Benjamin Gross

unread,
Oct 4, 2019, 2:16:50 PM10/4/19
to Eric Blanc, cBioPortal for Cancer Genomics Discussion Group
Yeah, its gotta get into the war.  Let me know how it goes.


-- 
You received this message because you are subscribed to the Google Groups "cBioPortal for Cancer Genomics Discussion Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cbioportal+...@googlegroups.com.

Eric Blanc

unread,
Oct 4, 2019, 2:39:37 PM10/4/19
to cBioPortal for Cancer Genomics Discussion Group
So I have rebuilt my portal (mvn -DskipTests clean install), but the problem persists, and I can't find the keystore in the war file using

jar -tvf portal/target/cbioportal.war | grep jks

Is it possible that the maven step doesn't roll the keystore file into the cbioportal.war?

Thanks again,
Eric

On Friday, October 4, 2019 at 1:24:07 PM UTC+2, Eric Blanc wrote:

Benjamin Gross

unread,
Oct 4, 2019, 2:52:40 PM10/4/19
to Eric Blanc, cBioPortal for Cancer Genomics Discussion Group
The way the code is setup, if the file goes into $PORTAL_HOME/portal/src/main/resources, it should end-up on the class path.  Is that where you put it?

--
You received this message because you are subscribed to the Google Groups "cBioPortal for Cancer Genomics Discussion Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cbioportal+...@googlegroups.com.

Eric Blanc

unread,
Oct 4, 2019, 3:51:13 PM10/4/19
to cBioPortal for Cancer Genomics Discussion Group
I'm sorry to have wasted your time, I had put it in src/main/resources, not in portal/src/main/resources as stated in the documentation. Now the keystore is in the war file, and it is accessible by the portal.

However, I am now facing another set of errors: the cBioPortal log states that:

2019-10-04 21:40:33 [http-nio-8081-exec-4] DEBUG org.springframework.security.web.FilterChainProxy - /index.jsp at position 1 of 10 in additional filter chain; firing Filter: 'MetadataGeneratorFilter'
2019-10-04 21:40:33 [http-nio-8081-exec-4] INFO  org.springframework.security.saml.metadata.MetadataGeneratorFilter - No default metadata configured, generating with default values, please pre-configure metadata for production use
2019-10-04 21:40:33 [http-nio-8081-exec-4] ERROR org.opensaml.xml.security.credential.KeyStoreCredentialResolver - Unable to retrieve keystore entry for entityID (keystore alias): secure-key
2019-10-04 21:40:33 [http-nio-8081-exec-4] ERROR org.opensaml.xml.security.credential.KeyStoreCredentialResolver - Check for invalid keystore entityID/alias entry password

The keystore is readable using keytool -list, and it has a secure-key alias. Any idea what has gone wrong?

Thanks, and sorry again.

On Friday, October 4, 2019 at 1:24:07 PM UTC+2, Eric Blanc wrote:

Benjamin Gross

unread,
Oct 6, 2019, 11:50:12 AM10/6/19
to Eric Blanc, cBioPortal for Cancer Genomics Discussion Group
Hi Eric,

Based on this message "Check for invalid keystore entityID/alias entry password
my only thought it to run the keytool -keypasswd command to verify (or set) the key password for the secure-key entry.  I haven’t done this, but I think this may be the command

keytool -keypasswd -keystore samlKeystore.jks -alias secure-key

In lieu of this, you may just want to try and create a new keystore file.

B

--
You received this message because you are subscribed to the Google Groups "cBioPortal for Cancer Genomics Discussion Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cbioportal+...@googlegroups.com.

Eric Blanc

unread,
Oct 6, 2019, 3:16:53 PM10/6/19
to cBioPortal for Cancer Genomics Discussion Group
Hi Benjamin,

That was indeed a faulty keystore: the connection can be made using a new keystore.

Thanks for your help,
Eric


On Friday, October 4, 2019 at 1:24:07 PM UTC+2, Eric Blanc wrote:

Benjamin Gross

unread,
Oct 7, 2019, 9:49:35 AM10/7/19
to Eric Blanc, cBioPortal for Cancer Genomics Discussion Group
Glad to hear it!
B

--
You received this message because you are subscribed to the Google Groups "cBioPortal for Cancer Genomics Discussion Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cbioportal+...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages