How to get current Identity Provider in Java Application in SAP Cloud Platform

Hi all,

We would like to get the current identity provider(IDP) in Java codes which iseither IDP's URL or name. For example, the default one is "accounts.sap.com", and it is exactly what we want.

The background is that we have multiple tenancies and each one is using a different IDP. We want our Java Code to be able to know which IDP the tenant will use. The example is shown below.

Is there any API in Java to get the name of the IDP marked in red.

Thanks in advance.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Jun 09, 2017 at 07:54 AM

    Hi Ziyi,

    I haven't tried to get the current IdP URL from within Java code, but you might be interested in using Default Attributes for each IdP to check, where the request is coming from? The default attribute will be sent with every user and will change depending on where the request is coming from.
    e.g.

    IdP1 -> Default attribute "idpCode" : "IdP1"
    IdP2 -> Default attribute "idpCode" : "IdP2"

    In Java you can read the idpCode Attribute, like shown here: https://github.com/SAP/cloud-sample-library/blob/master/library/src/main/java/com/sap/hana/cloud/samples/adapters/IdentityAdapter.java

    Not the exact answer to your question. However I hope that might help.

    Best regards

    Daniel

    Add comment
    10|10000 characters needed characters exceeded

Skip to Content