use of com.sun.identity.shared.debug.Debug in project OpenAM by OpenRock.
the class LdapSearchHandlerTest method setUp.
@BeforeMethod
public void setUp() throws Exception {
mockConnection = mock(Connection.class);
mockRequest = mock(SearchRequest.class);
debug = mock(Debug.class);
handler = new LdapSearchHandler(new CTSDataLayerConfiguration("ou=test-case"), debug);
}
use of com.sun.identity.shared.debug.Debug in project OpenAM by OpenRock.
the class AMIdentityMembershipConditionTest method setUp.
@BeforeMethod
public void setUp() {
Debug debug = mock(Debug.class);
coreWrapper = mock(CoreWrapper.class);
condition = new AMIdentityMembershipCondition(debug, coreWrapper);
adminToken = mock(SSOToken.class);
given(coreWrapper.getAdminToken()).willReturn(adminToken);
}
use of com.sun.identity.shared.debug.Debug in project OpenAM by OpenRock.
the class OpenAMTokenStoreTest method setUp.
@BeforeMethod
public void setUp() {
tokenStore = mock(OAuthTokenStore.class);
providerSettingsFactory = mock(OAuth2ProviderSettingsFactory.class);
oAuth2UrisFactory = mock(OAuth2UrisFactory.class);
clientRegistrationStore = mock(OpenIdConnectClientRegistrationStore.class);
realmNormaliser = mock(RealmNormaliser.class);
ssoTokenManager = mock(SSOTokenManager.class);
request = mock(Request.class);
cookieExtractor = mock(CookieExtractor.class);
auditLogger = mock(OAuth2AuditLogger.class);
debug = mock(Debug.class);
failureFactory = mock(ClientAuthenticationFailureFactory.class);
oAuth2RequestFactory = new RestletOAuth2RequestFactory(new JacksonRepresentationFactory(new ObjectMapper()));
ClientAuthenticationFailureFactory failureFactory = mock(ClientAuthenticationFailureFactory.class);
InvalidClientException expectedResult = mock(InvalidClientException.class);
when(expectedResult.getError()).thenReturn(new String("invalid_client"));
when(failureFactory.getException()).thenReturn(expectedResult);
when(failureFactory.getException(anyString())).thenReturn(expectedResult);
when(failureFactory.getException(any(OAuth2Request.class), anyString())).thenReturn(expectedResult);
openAMtokenStore = new OpenAMTokenStore(tokenStore, providerSettingsFactory, oAuth2UrisFactory, clientRegistrationStore, realmNormaliser, ssoTokenManager, cookieExtractor, auditLogger, debug, new SecureRandom(), failureFactory);
}
use of com.sun.identity.shared.debug.Debug in project OpenAM by OpenRock.
the class JCEEncryption method pbeEncrypt.
/**
* Method declaration
*
* @param clearText
*/
private byte[] pbeEncrypt(final byte[] clearText) {
byte[] result = null;
if (clearText == null || clearText.length == 0) {
return null;
}
if (_initialized) {
try {
byte[] type = new byte[2];
type[1] = (byte) DEFAULT_ENC_ALG_INDEX;
type[0] = (byte) DEFAULT_KEYGEN_ALG_INDEX;
final Cipher pbeCipher = cipherProvider.getCipher();
if (pbeCipher != null) {
pbeCipher.init(Cipher.ENCRYPT_MODE, pbeKey, pbeParameterSpec);
result = pbeCipher.doFinal(clearText);
byte[] iv = pbeCipher.getIV();
result = addPrefix(type, iv, result);
} else {
Debug debug = Debug.getInstance("amSDK");
if (debug != null) {
debug.error("JCEEncryption: Failed to obtain Cipher");
}
}
} catch (Exception ex) {
Debug debug = Debug.getInstance("amSDK");
if (debug != null) {
debug.error("JCEEncryption:: failed to encrypt data", ex);
}
}
} else {
Debug debug = Debug.getInstance("amSDK");
if (debug != null) {
debug.error("JCEEncryption:: not yet initialized");
}
}
return result;
}
use of com.sun.identity.shared.debug.Debug in project OpenAM by OpenRock.
the class JCEEncryption method pbeDecrypt.
/**
* Method declaration
*
* @param cipherText
*/
private byte[] pbeDecrypt(byte[] cipherText) {
byte[] result = null;
if (_initialized) {
try {
byte[] share = cipherText;
if (share[0] != VERSION) {
Debug debug = Debug.getInstance("amSDK");
if (debug != null) {
debug.error("JCEEncryption:: Unsupported version: " + share[0]);
}
return null;
}
byte[] raw = getRaw(share);
final Cipher pbeCipher = cipherProvider.getCipher();
if (pbeCipher != null) {
pbeCipher.init(Cipher.DECRYPT_MODE, pbeKey, pbeParameterSpec);
result = pbeCipher.doFinal(raw);
} else {
Debug debug = Debug.getInstance("amSDK");
if (debug != null) {
debug.error("JCEEncryption: Failed to obtain Cipher");
}
}
} catch (Exception ex) {
Debug debug = Debug.getInstance("amSDK");
if (debug != null) {
debug.error("JCEEncryption:: failed to decrypt data", ex);
}
}
} else {
Debug debug = Debug.getInstance("amSDK");
if (debug != null) {
debug.error("JCEEncryption:: not yet initialized");
}
}
return result;
}
Aggregations