Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SDKS-3284 Inconsistent behavior when forgerock_url is not provided. #428

Merged
merged 1 commit into from
Jun 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019 - 2023 ForgeRock. All rights reserved.
* Copyright (c) 2019 - 2024 ForgeRock. All rights reserved.
*
* This software may be modified and distributed under the terms
* of the MIT license. See the LICENSE file for details.
Expand Down Expand Up @@ -30,6 +30,7 @@
*/
public class FRAuth {

private static final String TAG = FRAuth.class.getSimpleName();
private AuthService authService;
private SessionManager sessionManager;

Expand All @@ -50,8 +51,12 @@ public static synchronized void start(Context context, @Nullable FROptions optio
//Validate (AM URL, Realm, CookieName) is not Empty. If its empty will throw IllegalArgumentException.
currentOptions.validateConfig();
if (ConfigHelper.isConfigDifferentFromPersistedValue(context, currentOptions)) {
SessionManager sessionManager = ConfigHelper.getPersistedConfig(context, cachedOptions).getSessionManager();
sessionManager.close();
try {
SessionManager sessionManager = ConfigHelper.getPersistedConfig(context, cachedOptions).getSessionManager();
sessionManager.close();
} catch (Exception e) {
Logger.warn(TAG, "Failed to close the session manager", e);
}
}
Config.getInstance().init(context, currentOptions);
ConfigHelper.persist(context, currentOptions);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ data class FROptions(val server: Server,
@Throws(IllegalArgumentException::class)
@JvmName("validateConfig")
internal fun validateConfig() {
require(server.url.isNotBlank()) { "AM URL cannot be blank" }
require(server.url.isNotBlank()) { "Server URL cannot be blank" }
require(server.realm.isNotBlank()) { "Realm cannot be blank" }
require(server.cookieName.isNotBlank()) { "cookieName cannot be blank" }
}
Expand Down
4 changes: 2 additions & 2 deletions forgerock-auth/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
<string name="forgerock_oauth_url" translatable="false">place holder</string>
<integer name="forgerock_oauth_threshold" translatable="false">30</integer> <!-- in second -->
<integer name="forgerock_oauth_cache" translatable="false">0</integer> <!-- in second -->
<string name="forgerock_oauth_sign_out_redirect_uri" translatable="false">place holder</string>
<string name="forgerock_oauth_sign_out_redirect_uri" translatable="false" />

<!-- Server -->
<string name="forgerock_url" translatable="false">place holder</string>
<string name="forgerock_url" translatable="false" />
<string name="forgerock_realm" translatable="false">root</string>
<integer name="forgerock_timeout" translatable="false">30</integer>
<integer name="forgerock_cookie_cache" translatable="false">0</integer> <!-- in second -->
Expand Down
Loading