Class ClaimsService


  • public class ClaimsService
    extends Object
    This class is responsible to construct the claims.
    • Constructor Detail

      • ClaimsService

        public ClaimsService()
    • Method Detail

      • getErrorDesc

        public String getErrorDesc()
      • getClaims

        public Map<String,​String> getClaims​(String responseURL,
                                                  String redirectUri,
                                                  String discoveryUri,
                                                  String clientID,
                                                  String secretCode,
                                                  String storedNonce,
                                                  String truststorePath,
                                                  String truststorePassword,
                                                  String decryptionKeystore,
                                                  String decryptionKeystorePassword,
                                                  String decryptionKeyAlias)
                                           throws Exception
        Retrieves ID Token from OIDC Token end point
        Parameters:
        responseURL - URL with query string returned by authorization server
        redirectUri - redirect URL matching the one sent for authorization request
        discoveryUri - To discover OIDC supported claims and JWKS URI
        clientID - Merchant identifier provided by Nets
        secretCode - Authentication password to access token end point URL, provided by Nets
        storedNonce - nonce sent to authorization server, used to mitigate replay attacks
        truststorePath - SSL truststore to access discovery URL and Token end point URL
        truststorePassword - SSL truststore password
        Returns:
        Claims in key value format
        Throws:
        Exception - is thrown in case of any error
      • decryptJWT

        public com.nimbusds.jwt.SignedJWT decryptJWT​(String encryptedRequest,
                                                     String decryptionKeystore,
                                                     String decryptionKeystorePassword,
                                                     String decryptionKeyAlias)
                                              throws Exception
        Decrypt the encrypted id-token
        Parameters:
        encryptedRequest - : encrypted id-token string
        decryptionKeystore - : merchant private key (p12) for decryption.
        decryptionKeystorePassword - : merchant private key (p12) password.
        Returns:
        SignedJWT decrypted SignedJWT id-token
        Throws:
        Exception
      • getHTTPRequest

        public com.nimbusds.oauth2.sdk.http.HTTPRequest getHTTPRequest​(String url,
                                                                       String truststorePath,
                                                                       String truststorePassword)
                                                                throws Exception
        Generates HTTPRequest with the given input
        Parameters:
        url - Request url
        truststorePath - SSL truststore path
        truststorePassword - SSL truststore password
        Returns:
        Generated HTTPRequest object
        Throws:
        Exception - is thrown in case of error
      • getSSLSocketFactory

        public SSLSocketFactory getSSLSocketFactory​(String truststorePath,
                                                    String truststorePassword)
                                             throws Exception
        Returns SSLSocketFactory
        Parameters:
        truststorePath - SSL truststore file path
        truststorePassword - SSL truststore password
        Returns:
        SSLSocketFactory object
        Throws:
        Exception - is thrown in case of error
      • generateEIdentUrl

        public String generateEIdentUrl​(String mid,
                                        String scope,
                                        String itsURL)
        Generating EIdent URL
        Parameters:
        mid -
        scope -
        itsURL -
        Returns: