Skip to content

Commit 54a1130

Browse files
committed
Changes for v1.5.0
1 parent 04b30ba commit 54a1130

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+1690
-554
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# cordova-plugin-oracle-idm-auth 1.4.0
1+
# cordova-plugin-oracle-idm-auth 1.5.0
22

33
## About the cordova-plugin-oracle-idm-auth
44
The plugin provides authentication and authorization functionality for cordova based mobile applications,

RELEASENOTES.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Release Notes
22

3+
## 1.5.0 (11 May, 2020)
4+
* Support for CSRF Protection for token relay service.
5+
36
## 1.4.0 (8 Apr, 2020)
47
* Removing the referencing of UIWebView as per Apple guideline.
58

plugin.xml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
77
xmlns:android="http://schemas.android.com/apk/res/android"
88
id="cordova-plugin-oracle-idm-auth"
9-
version="1.4.0">
9+
version="1.5.0">
1010
<name>cordova-plugin-oracle-idm-auth</name>
1111
<description>Provides authentication and authorization functionality using the Oracle IDM SDK, supporting standard protocols like Basic Auth, OAUTH, OpenID Connect and WebSSO</description>
1212
<keywords>cordova,idm,authentication,auth</keywords>
@@ -121,6 +121,7 @@
121121
<source-file src="src/android/sdk/oracle/idm/mobile/auth/RefreshTokenAuthenticationService.java" target-dir="src/oracle/idm/mobile/auth/"/>
122122
<source-file src="src/android/sdk/oracle/idm/mobile/auth/TimeoutManager.java" target-dir="src/oracle/idm/mobile/auth/"/>
123123
<source-file src="src/android/sdk/oracle/idm/mobile/auth/TwoWaySSLCompletionHandler.java" target-dir="src/oracle/idm/mobile/auth/"/>
124+
<source-file src="src/android/sdk/oracle/idm/mobile/auth/UsernamePasswdAuthServiceInputCallbackImpl.java" target-dir="src/oracle/idm/mobile/auth/"/>
124125
<source-file src="src/android/sdk/oracle/idm/mobile/auth/local/AndroidKeyStoreKeyProvider.java" target-dir="src/oracle/idm/mobile/auth/local/"/>
125126
<source-file src="src/android/sdk/oracle/idm/mobile/auth/local/DefaultKeyProvider.java" target-dir="src/oracle/idm/mobile/auth/local/"/>
126127
<source-file src="src/android/sdk/oracle/idm/mobile/auth/local/KeyProvider.java" target-dir="src/oracle/idm/mobile/auth/local/"/>
@@ -178,6 +179,7 @@
178179
<source-file src="src/android/sdk/oracle/idm/mobile/connection/SSLExceptionEvent.java" target-dir="src/oracle/idm/mobile/connection/"/>
179180
<source-file src="src/android/sdk/oracle/idm/mobile/credentialstore/OMCredential.java" target-dir="src/oracle/idm/mobile/credentialstore/"/>
180181
<source-file src="src/android/sdk/oracle/idm/mobile/credentialstore/OMCredentialStore.java" target-dir="src/oracle/idm/mobile/credentialstore/"/>
182+
<source-file src="src/android/sdk/oracle/idm/mobile/credentialstore/OMClassicCredentialStore.java" target-dir="src/oracle/idm/mobile/credentialstore/"/>
181183
<source-file src="src/android/sdk/oracle/idm/mobile/crypto/Base64.java" target-dir="src/oracle/idm/mobile/crypto/"/>
182184
<source-file src="src/android/sdk/oracle/idm/mobile/crypto/CryptoException.java" target-dir="src/oracle/idm/mobile/crypto/"/>
183185
<source-file src="src/android/sdk/oracle/idm/mobile/crypto/CryptoScheme.java" target-dir="src/oracle/idm/mobile/crypto/"/>
@@ -202,6 +204,7 @@
202204
<source-file src="src/android/sdk/oracle/idm/mobile/util/OMVersion.java" target-dir="src/oracle/idm/mobile/util/"/>
203205
<source-file src="src/android/sdk/oracle/idm/mobile/util/StringUtils.java" target-dir="src/oracle/idm/mobile/util/"/>
204206
<source-file src="src/android/sdk/oracle/idm/mobile/util/URLUtils.java" target-dir="src/oracle/idm/mobile/util/"/>
207+
<source-file src="src/android/sdk/oracle/idm/mobile/util/ArrayUtils.java" target-dir="src/oracle/idm/mobile/util/"/>
205208
</platform>
206209

207210
<!-- ios -->

src/android/sdk/oracle/idm/mobile/OMErrorCode.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,9 @@ public enum OMErrorCode {
134134
* This seems to be a bug in emulator. This should not arise in a device.
135135
*/
136136
NO_FINGERPRINT_ENROLLED("10536", "At least one fingerprint must be enrolled to create keys requiring user authentication for every use"),
137-
DISABLE_AUTHENTICATOR_INSTANCE("60014", "Disable Authentication for all instances of authenticator.");
137+
DISABLE_AUTHENTICATOR_INSTANCE("60014", "Disable Authentication for all instances of authenticator."),
138138

139+
INCORRECT_CURRENT_AUTHDATA("70009", "Cannot authenticate using currentAuthData");
139140

140141
String mErrorCode;
141142
String mErrorMessage;
@@ -179,7 +180,7 @@ public static OMErrorCode[] getRecoverableErrorCodes() {
179180
if (mRecoverableCodes == null) {
180181
mRecoverableCodes = new OMErrorCode[]{OMErrorCode.USERNAME_REQUIRED, OMErrorCode.PASSWORD_REQUIRED,
181182
OMErrorCode.IDENTITY_DOMAIN_REQUIRED, OMErrorCode.USERNAME_AND_IDENTITY_DOMAIN_REQUIRED,
182-
OMErrorCode.UN_PWD_INVALID, OMErrorCode.UNABLE_TO_CONNECT_TO_SERVER};
183+
OMErrorCode.UN_PWD_INVALID, OMErrorCode.UN_PWD_TENANT_INVALID, OMErrorCode.UNABLE_TO_CONNECT_TO_SERVER};
183184
}
184185
return mRecoverableCodes;
185186
}

src/android/sdk/oracle/idm/mobile/OMMobileSecurityService.java

Lines changed: 34 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -803,7 +803,7 @@ public OMMobileSecurityService(Context context,
803803
*/
804804
public OMMobileSecurityService(Context context,
805805
String configurationPropertiesKey, OMMobileSecurityServiceCallback callback)
806-
throws JSONException, OMMobileSecurityException {
806+
throws OMMobileSecurityException {
807807
this(context, OMMobileSecurityConfiguration.getInitializationConfiguration(context,
808808
configurationPropertiesKey), callback);
809809
}
@@ -930,6 +930,8 @@ protected void onPostExecute(OMMobileSecurityException e) {
930930
.UNTRUSTED_SERVER_CERTIFICATE_AUTH_TYPE_KEY, sslEvent.getAuthType());
931931
sslChallenge.addChallengeField(OMSecurityConstants.Challenge
932932
.UNTRUSTED_SERVER_CERTIFICATE_CHAIN_KEY, sslEvent.getCertificateChain());
933+
sslChallenge.addChallengeField(OMSecurityConstants.Challenge
934+
.UNTRUSTED_SERVER_URL_KEY, sslEvent.getURL());
933935
new Setup1WaySSLCompletionHandler(sMSS.getMobileSecurityConfig(), sMSS.getCallback()).createChallengeRequest(sMSS, sslChallenge, null);
934936
//handle 1-way SSL
935937
return;
@@ -1067,21 +1069,29 @@ public Context getApplicationContext() {
10671069

10681070
/**
10691071
* This method removes all session cookies when authenticate is called for
1070-
* first time after app launch. This is done, because android sometimes
1071-
* retains some session cookies even after app restart. E.g: User is logged
1072-
* in using Federated Authentication, and then the app is force stopped. The
1073-
* next time app is launched, if the session cookies are not removed, the
1072+
* first time after app launch. This is done, because android webview
1073+
* retains session cookies even after app restart.
1074+
* Ref: https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies#Session_cookies
1075+
* E.g: User is logged in using Federated Authentication, and
1076+
* then the app is force stopped. The next time app is launched,
1077+
* if the session cookies are not removed, the
10741078
* federated authentication flow will fail.
10751079
*/
10761080
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
10771081
private void removeSessionCookies() {
10781082
if (!authenticateCalledForFirstTime) {
10791083
authenticateCalledForFirstTime = true;
1080-
if (!getMobileSecurityConfig().isAuthContextPersistenceAllowed()) {
1081-
OMLog.debug(TAG,
1082-
"Authenticate API called for first time after app launch -> Removing session cookies");
1083-
OMCookieManager.getInstance().removeSessionCookies(getApplicationContext());
1084-
}
1084+
/*Session cookies are being cleared irrespective of
1085+
OM_PROP_SESSION_ACTIVE_ON_RESTART. This is because
1086+
once SDK indicates authContext is invalid after app-restart,
1087+
say based on access token expiry, authenticate() should prompt
1088+
for login screen. If session cookies are not cleared here,
1089+
user will not be prompted for authentication, if session cookies
1090+
are still valid. This will also make the behavior similar
1091+
to iOS.*/
1092+
OMLog.debug(TAG,
1093+
"Authenticate API called for first time after app launch -> Removing session cookies");
1094+
OMCookieManager.getInstance().removeSessionCookies(getApplicationContext());
10851095
}
10861096
}
10871097

@@ -1325,6 +1335,20 @@ public void onLogoutCompleted() {
13251335
timeoutManager.stopTimers();
13261336
}
13271337
authenticationContext.deleteCookies();
1338+
/**This is called with all parameters passed as true
1339+
* to make sure that if authentication context is retrieved
1340+
* by app in onLogoutCompleted, it will be null. Actual
1341+
* authContext to be persisted is written in
1342+
* {@link OMAuthenticationContext#deleteAuthContext(boolean, boolean, boolean, boolean)}
1343+
* by calling {@link OMAuthenticationContext#deletePersistedAuthContext(boolean, boolean, boolean)}.
1344+
* This is done because before {@link OMMobileSecurityService#logout(boolean)}l is executed completely,
1345+
* onLogoutCompleted() can be called.
1346+
* e.g: Google OpenID logout, external browser flow.*/
1347+
boolean authContextPersistenceAllowed = getMobileSecurityConfig()
1348+
.isAuthContextPersistenceAllowed();
1349+
if (authContextPersistenceAllowed) {
1350+
authenticationContext.deletePersistedAuthContext(true, true, true);
1351+
}
13281352
}
13291353
removeSessionCookiesOnLogout();
13301354
resetAuthServiceManager();

src/android/sdk/oracle/idm/mobile/OMSecurityConstants.java

Lines changed: 47 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public class OMSecurityConstants {
1313

1414
/**
1515
* Change this boolean to enable/disable debug logging in SDK.
16-
*
16+
* <p>
1717
* Cannot use {@link BuildConfig#DEBUG} in library project because of
1818
* https://issuetracker.google.com/issues/36967265
1919
* <p>
@@ -24,6 +24,7 @@ public class OMSecurityConstants {
2424
*/
2525
public static boolean DEBUG = false;
2626

27+
public static final String UTF_8 = "UTF-8";
2728
public static final char COLON = ':';
2829
public static final char EQUAL = '=';
2930
public static final char AMPERSAND = '&';
@@ -59,17 +60,38 @@ public class OMSecurityConstants {
5960

6061
/*TODO Documentation*/
6162
//TODO Add javadoc for every constant following the format specified for CLIENT_CERTIFICATE_HOST
63+
6264
/**
6365
* Holds constants specific to OMAuthenticationChallenge
6466
*/
6567
public static class Challenge {
6668
public static final String USERNAME_KEY = "username_key";
69+
/**
70+
* The key against which the following is present or MUST be provided:
71+
* the password of the end user.
72+
* <p/>
73+
* The value is of type {@link String}.
74+
*
75+
* @deprecated This accepts or provides password as String which leads to security issues.
76+
* This field will be removed in a future release. This is maintained now just to have
77+
* backward compatibility. Instead of this field, use {@link #PASSWORD_KEY_2}.
78+
*/
79+
@Deprecated
6780
public static final String PASSWORD_KEY = "password_key";
81+
82+
/**
83+
* The key against which the following is present or MUST be provided:
84+
* the password of the end user.
85+
* <p/>
86+
* The value is of type char[].
87+
*/
88+
public static final String PASSWORD_KEY_2 = "password_as_char_array_key";
89+
6890
public static final String IDENTITY_DOMAIN_KEY = "iddomain_key";
6991
public static final String OFFLINE_CREDENTIAL_KEY = "offline_credential_key";
70-
public static final String IS_FORCE_AUTHENTICATION ="isForceAuthentication";
92+
public static final String IS_FORCE_AUTHENTICATION = "isForceAuthentication";
7193
/**
72-
* The key against the following is present:
94+
* The key against which the following is present:
7395
* Exception thrown in the authentication attempt
7496
* <p/>
7597
* The value is of type {@link OMMobileSecurityException}.
@@ -78,7 +100,7 @@ public static class Challenge {
78100
public static final String MOBILE_SECURITY_EXCEPTION = "mobileSecurityException";
79101

80102
/**
81-
* The key against the following is present:
103+
* The key against which the following is present:
82104
* the host name of the server requesting the certificate
83105
* <p/>
84106
* The value is of type {@link String}.
@@ -89,7 +111,7 @@ public static class Challenge {
89111
public static final String CLIENT_CERTIFICATE_HOST = "client_certificate_host_key";
90112

91113
/**
92-
* The key against the following is present:
114+
* The key against which the following is present:
93115
* the port number of the server requesting the certificate
94116
* <p/>
95117
* The value is of type {@link Integer}.
@@ -100,7 +122,7 @@ public static class Challenge {
100122
public static final String CLIENT_CERTIFICATE_PORT = "client_certificate_port_key";
101123

102124
/**
103-
* The key against the following is present:
125+
* The key against which the following is present:
104126
* the acceptable certificate issuers for the certificate matching the private key (can be null)
105127
* null implies any issuer will do.
106128
* <p/>
@@ -112,22 +134,22 @@ public static class Challenge {
112134
public static final String CLIENT_CERTIFICATE_ISSUERS_KEY = "client_certificate_issuer_names_key";
113135

114136
/**
115-
* The key against the following is present:
137+
* The key against which the following is present:
116138
* the acceptable types of asymmetric keys (can be null) or in other words: the list of public key algorithm names
117-
*
139+
* <p>
118140
* The value is of type {@link String}[].
119-
*
141+
* <p>
120142
* <b>Note:</b> Client certificate authentication in embedded browser [Fed Auth, OAuth] is supported only from LOLLIPOP onwards.
121143
* Refer {@link oracle.idm.mobile.OMMobileSecurityService.AuthServerType} for more details.
122144
*/
123145
public static final String CLIENT_CERTIFICATE_KEYTYPES_KEY = "client_certificate_keytypes_key";
124146

125147
/**
126-
* The key against the following MUST BE provided by the developer:
148+
* The key against which the following MUST BE provided by the developer:
127149
* the alias for the client side of an SSL connection to authenticate it with the specified public key type and certificate issuers
128-
*
150+
* <p>
129151
* The value MUST be of type {@link String}
130-
*
152+
* <p>
131153
* <b>Note:</b> Client certificate authentication in embedded browser [Fed Auth, OAuth] is supported only from LOLLIPOP onwards.
132154
* Refer {@link oracle.idm.mobile.OMMobileSecurityService.AuthServerType} for more details.
133155
*/
@@ -144,6 +166,15 @@ public static class Challenge {
144166
public static final String CLIENT_CERTIFICATE_STORAGE_PREFERENCE_KEY = "client_certificate_storage_pref_key";
145167
public static final String UNTRUSTED_SERVER_CERTIFICATE_AUTH_TYPE_KEY = "untrusted_certificate_authtype_key";
146168
public static final String UNTRUSTED_SERVER_CERTIFICATE_CHAIN_KEY = "untrusted_server_certificate_chain_key";
169+
/**
170+
* The key against which the following is present:
171+
* The URL of the server being accessed which resulted
172+
* in {@link javax.net.ssl.SSLHandshakeException}.
173+
* <p>
174+
* The value is of type {@link java.net.URL}.
175+
* <p>
176+
*/
177+
public static final String UNTRUSTED_SERVER_URL_KEY = "untrusted_server_url_key";
147178
public static final String INVALID_REDIRECT_TYPE_KEY = "invalid_redirect_type_key";
148179

149180

@@ -170,6 +201,7 @@ public static class Challenge {
170201
public static final String EXPIRY_DATE = "expiresdate";
171202
public static final String EXPIRES_IN = "expires_in";
172203
public static final String IS_SECURE = "issecure";
204+
173205
/**
174206
* Constants to represent parameter keys used internally in SDK.
175207
*
@@ -179,6 +211,7 @@ public static class Param {
179211
public static final String OAUTH_REFRESH_TOKEN_VALUE = "ParamOAuthRefreshTokenValue";
180212
public static final String OAUTH_FRONT_CHANNEL_RESPONSE_JSON = "ParamFrontChannelResponseJSON";
181213
public static final String COLLECT_OFFLINE_CREDENTIAL = "collectOfflineCredential";
214+
public static final String CLEAR_PASSWORD = "clearPassword";
182215
//Begin: Fed Auth
183216
public static final String LOGIN_FAILURE_URL_HIT = "login_failure_url_hit";
184217
public static final String VISITED_URLS = "visited_urls";
@@ -244,4 +277,6 @@ public class Flags {
244277
public static final int CONNECTION_ALLOW_HTTPS_TO_HTTP_REDIRECT = 103;
245278
public static final int CONNECTION_ALLOW_HTTP_TO_HTTPS_REDIRECT = 104;
246279
}
280+
281+
public static final String OM_CREDENTIAL = "_Credential";
247282
}

0 commit comments

Comments
 (0)