public class DefaultCipherService extends java.lang.Object implements CipherService
CipherService.| Modifier and Type | Field and Description |
|---|---|
protected static java.lang.String |
CHARACTER_ENCODING |
| Constructor and Description |
|---|
DefaultCipherService() |
| Modifier and Type | Method and Description |
|---|---|
protected static java.lang.String |
encode(java.lang.String notEncoded)
Used to grant correct character encoding through web.
|
java.lang.String |
encrypt(java.lang.String userId,
PunchOutSession punchoutSession)
Create a hash for a given user to be used in punchout login.
|
ConfigurationService |
getConfigurationService() |
protected java.lang.String |
getUnsecureText(java.lang.String userId,
PunchOutSession punchoutSession)
Gets text used for asymmetric encryption.
|
java.lang.String |
retrieveUserId(java.lang.String encryptedText,
PunchOutSession punchoutSession)
Retrieves the userId for a given encrypted text.
|
void |
setConfigurationService(ConfigurationService configurationService) |
protected boolean |
verify(java.lang.String hash,
java.lang.String userId,
PunchOutSession punchoutSession)
Generates a hash given the session data and verifies if it matches the hash provided.
|
protected void |
verifyPunchOutSession(PunchOutSession punchoutSession) |
protected static final java.lang.String CHARACTER_ENCODING
public java.lang.String encrypt(java.lang.String userId,
PunchOutSession punchoutSession)
CipherServiceencrypt in interface CipherServiceuserId - The human readable id of the user that will get an associated hash.punchoutSession - The session of the current punchout user.public java.lang.String retrieveUserId(java.lang.String encryptedText,
PunchOutSession punchoutSession)
throws PunchOutCipherException,
java.lang.IllegalArgumentException
CipherServiceretrieveUserId in interface CipherServiceencryptedText - The text to be decrypted.punchoutSession - The session of the current punchout user.PunchOutCipherException - If Cipher has issues decrypting the text.java.lang.IllegalArgumentException - If some of the required arguments is missing or empty.protected void verifyPunchOutSession(PunchOutSession punchoutSession) throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentExceptionprotected static java.lang.String encode(java.lang.String notEncoded)
notEncoded - CHARACTER_ENCODING.protected boolean verify(java.lang.String hash,
java.lang.String userId,
PunchOutSession punchoutSession)
throws java.lang.IllegalArgumentException
hash - The hash that should be validated.userId - The user that was used to create the hash.punchoutSession - The current punchout session.java.lang.IllegalArgumentException - If arguments are null or empty.protected java.lang.String getUnsecureText(java.lang.String userId,
PunchOutSession punchoutSession)
userId - punchoutSession - public ConfigurationService getConfigurationService()
public void setConfigurationService(ConfigurationService configurationService)
Copyright © 2018 SAP SE. All Rights Reserved.