Class ClaimsService
- java.lang.Object
-
- eu.nets.sis.eident.demoapp.service.ClaimsService
-
public class ClaimsService extends Object
This class is responsible to construct the claims.
-
-
Field Summary
Fields Modifier and Type Field Description static StringDATE_FORMATstatic StringNONCEstatic StringRSA_ALGORITHM
-
Constructor Summary
Constructors Constructor Description ClaimsService()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description com.nimbusds.jwt.SignedJWTdecryptJWT(String encryptedRequest, String decryptionKeystore, String decryptionKeystorePassword, String decryptionKeyAlias)Decrypt the encrypted id-tokenStringgenerateEIdentUrl(String mid, String scope, String itsURL)Generating EIdent URLMap<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)Retrieves ID Token from OIDC Token end pointStringgetErrorDesc()com.nimbusds.oauth2.sdk.http.HTTPRequestgetHTTPRequest(String url, String truststorePath, String truststorePassword)Generates HTTPRequest with the given inputSSLSocketFactorygetSSLSocketFactory(String truststorePath, String truststorePassword)Returns SSLSocketFactory
-
-
-
Field Detail
-
DATE_FORMAT
public static final String DATE_FORMAT
- See Also:
- Constant Field Values
-
RSA_ALGORITHM
public static final String RSA_ALGORITHM
- See Also:
- Constant Field Values
-
NONCE
public static final String NONCE
- See Also:
- Constant Field Values
-
-
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 serverredirectUri- redirect URL matching the one sent for authorization requestdiscoveryUri- To discover OIDC supported claims and JWKS URIclientID- Merchant identifier provided by NetssecretCode- Authentication password to access token end point URL, provided by NetsstoredNonce- nonce sent to authorization server, used to mitigate replay attackstruststorePath- SSL truststore to access discovery URL and Token end point URLtruststorePassword- 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 stringdecryptionKeystore- : 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 urltruststorePath- SSL truststore pathtruststorePassword- 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 pathtruststorePassword- SSL truststore password- Returns:
- SSLSocketFactory object
- Throws:
Exception- is thrown in case of error
-
-