Skip to content

Commit

Permalink
Merge pull request #426 from ForgeRock/SDKS-3279
Browse files Browse the repository at this point in the history
SDKS-3279 Support file base configuration for forgerock_oauth_sign_out_redirect_uri
  • Loading branch information
spetrov authored Jun 19, 2024
2 parents 0fe0811 + 072dc7f commit 705bff0
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2022 - 2023 ForgeRock. All rights reserved.
* Copyright (c) 2022 - 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 @@ -156,6 +156,8 @@ internal class ConfigHelper {
oauthCacheSeconds =
context.resources.getInteger(R.integer.forgerock_oauth_cache)
.toLong()
oauthSignOutRedirectUri =
context.getString(R.string.forgerock_oauth_sign_out_redirect_uri)
}
sslPinning {
pins = context.resources
Expand Down
3 changes: 2 additions & 1 deletion forgerock-auth/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!--
~ Copyright (c) 2019 - 2022 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 All @@ -15,6 +15,7 @@
<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>

<!-- Server -->
<string name="forgerock_url" translatable="false">place holder</string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ class ConfigHelperTest {
@Test
fun loadDefaultFROptionWithNull() {
val defaultOption = ConfigHelper.load(context, null)
val expectedResult = "FROptions(server=Server(url=https://openam.example.com:8081/openam, realm=root, timeout=30, cookieName=iPlanetDirectoryPro, cookieCacheSeconds=0), oauth=OAuth(oauthClientId=andy_app, oauthRedirectUri=https://www.example.com:8080/callback, oauthSignOutRedirectUri=, oauthScope=openid email address, oauthThresholdSeconds=30, oauthCacheSeconds=0), service=Service(authServiceName=Test, registrationServiceName=Registration), urlPath=UrlPath(authenticateEndpoint=, revokeEndpoint=, sessionEndpoint=, tokenEndpoint=, userinfoEndpoint=, authorizeEndpoint=, endSessionEndpoint=), sslPinning=SSLPinning(buildSteps=[], pins=[9hNxmEFgLKGJXqgp61hyb8yIyiT9u0vgDZh4y8TmY/M=]), logger=Log(logLevel=null, customLogger=null))"
val expectedResult = "FROptions(server=Server(url=https://openam.example.com:8081/openam, realm=root, timeout=30, cookieName=iPlanetDirectoryPro, cookieCacheSeconds=0), oauth=OAuth(oauthClientId=andy_app, oauthRedirectUri=https://www.example.com:8080/callback, oauthSignOutRedirectUri=https://www.example.com:8080/signout, oauthScope=openid email address, oauthThresholdSeconds=30, oauthCacheSeconds=0), service=Service(authServiceName=Test, registrationServiceName=Registration), urlPath=UrlPath(authenticateEndpoint=, revokeEndpoint=, sessionEndpoint=, tokenEndpoint=, userinfoEndpoint=, authorizeEndpoint=, endSessionEndpoint=), sslPinning=SSLPinning(buildSteps=[], pins=[9hNxmEFgLKGJXqgp61hyb8yIyiT9u0vgDZh4y8TmY/M=]), logger=Log(logLevel=null, customLogger=null))"
assertTrue(defaultOption.toString() == expectedResult)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -940,6 +940,7 @@ public void testCustomEndpointAndCookieName() throws InterruptedException, Execu
when(mockContext.getString(R.string.forgerock_endsession_endpoint)).thenReturn("dummy/endSession");
when(mockContext.getString(R.string.forgerock_cookie_name)).thenReturn("testCookieName");
when(mockContext.getString(R.string.forgerock_auth_service)).thenReturn("UsernamePassword");
when(mockContext.getString(R.string.forgerock_oauth_sign_out_redirect_uri)).thenReturn(context.getString(R.string.forgerock_oauth_sign_out_redirect_uri));

enqueue("/authTreeMockTest_Authenticate_NameCallback.json", HttpURLConnection.HTTP_OK);
enqueue("/authTreeMockTest_Authenticate_PasswordCallback.json", HttpURLConnection.HTTP_OK);
Expand Down
3 changes: 2 additions & 1 deletion forgerock-auth/src/test/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!--
~ Copyright (c) 2019 - 2022 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 All @@ -11,6 +11,7 @@
<!-- OAuth -->
<string name="forgerock_oauth_client_id" translatable="false">andy_app</string>
<string name="forgerock_oauth_redirect_uri" translatable="false">https://www.example.com:8080/callback</string>
<string name="forgerock_oauth_sign_out_redirect_uri" translatable="false">https://www.example.com:8080/signout</string>
<string name="forgerock_oauth_scope" translatable="false">openid email address</string>
<string name="forgerock_oauth_url" translatable="false">https://openam.example.com:8081/openam</string>
<integer name="forgerock_oauth_threshold" translatable="false">30</integer> <!-- in second -->
Expand Down

0 comments on commit 705bff0

Please sign in to comment.