-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SDKS-3595 Remove Deprecated Sample Apps
- Loading branch information
Showing
361 changed files
with
223 additions
and
8,307 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
213 changes: 213 additions & 0 deletions
213
e2e/app/src/main/java/com/example/app/env/EnvViewModel.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,213 @@ | ||
/* | ||
* Copyright (c) 2023 - 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. | ||
*/ | ||
|
||
package com.example.app.env | ||
|
||
import android.content.Context | ||
import androidx.compose.runtime.getValue | ||
import androidx.compose.runtime.mutableStateOf | ||
import androidx.compose.runtime.setValue | ||
import androidx.lifecycle.ViewModel | ||
import androidx.lifecycle.viewModelScope | ||
import com.example.app.storage.loadCookiesStorage | ||
import com.example.app.storage.loadSSOTokenStorage | ||
import com.example.app.storage.loadTokenStorage | ||
import kotlinx.coroutines.launch | ||
import org.forgerock.android.auth.ContextProvider | ||
import org.forgerock.android.auth.FRAuth | ||
import org.forgerock.android.auth.FROptions | ||
import org.forgerock.android.auth.FROptionsBuilder | ||
|
||
const val USER_PROFILE_JOURNEY = "UserProfile" | ||
|
||
class EnvViewModel : ViewModel() { | ||
|
||
val servers = mutableListOf<FROptions>() | ||
|
||
val localhost = FROptionsBuilder.build { | ||
server { | ||
url = "https://andy.petrov.ca/openam" | ||
realm = "alpha" | ||
cookieName = "c1c805de4c9b333" | ||
timeout = 50 | ||
} | ||
oauth { | ||
oauthClientId = "c12743f9-08e8-4420-a624-71bbb08e9fe1" | ||
oauthRedirectUri = "org.forgerock.demo://oauth2redirect" | ||
oauthCacheSeconds = 0 | ||
oauthScope = "openid profile email address phone" | ||
oauthThresholdSeconds = 0 | ||
oauthSignOutRedirectUri = "org.forgerock.demo://oauth2redirect" | ||
} | ||
service { | ||
authServiceName = "protect" | ||
} | ||
} | ||
|
||
val dbind = FROptionsBuilder.build { | ||
server { | ||
url = "http://192.168.86.32:8080/openam" | ||
realm = "root" | ||
cookieName = "iPlanetDirectoryPro" | ||
timeout = 50 | ||
} | ||
oauth { | ||
oauthClientId = "AndroidTest" | ||
//oauthRedirectUri = "org.forgerock.demo:/oauth2redirect" | ||
oauthRedirectUri = "https://example.com/oauth2redirect" | ||
oauthCacheSeconds = 0 | ||
oauthScope = "openid profile email address phone" | ||
oauthThresholdSeconds = 0 | ||
} | ||
service { | ||
authServiceName = "sign-verifier-stoyan" | ||
} | ||
} | ||
|
||
val sdk = FROptionsBuilder.build { | ||
server { | ||
url = "https://openam-dbind.forgeblocks.com/am" | ||
realm = "alpha" | ||
cookieName = "43d72fc37bdde8c" | ||
timeout = 50 | ||
} | ||
oauth { | ||
oauthClientId = "AndroidTest" | ||
oauthRedirectUri = "org.forgerock.demo:/oauth2redirect" | ||
oauthCacheSeconds = 0 | ||
oauthScope = "openid profile email address phone" | ||
oauthThresholdSeconds = 0 | ||
} | ||
service { | ||
authServiceName = "WebAuthn" | ||
} | ||
} | ||
|
||
val local = FROptionsBuilder.build { | ||
server { | ||
url = "https://andy.petrov.ca/openam" | ||
realm = "root" | ||
cookieName = "iPlanetDirectoryPro" | ||
timeout = 50 | ||
} | ||
oauth { | ||
oauthClientId = "AndroidTest" | ||
oauthRedirectUri = "org.forgerock.demo:/oauth2redirect" | ||
oauthCacheSeconds = 0 | ||
oauthScope = "openid profile email address phone" | ||
oauthThresholdSeconds = 0 | ||
} | ||
service { | ||
authServiceName = "WebAuthn" | ||
} | ||
} | ||
|
||
val ops = FROptionsBuilder.build { | ||
server { | ||
url = "https://default.forgeops.petrov.ca/am" | ||
realm = "root" | ||
cookieName = "iPlanetDirectoryPro" | ||
timeout = 50 | ||
} | ||
oauth { | ||
oauthClientId = "AndroidTest" | ||
oauthRedirectUri = "org.forgerock.demo:/oauth2redirect" | ||
oauthCacheSeconds = 60 | ||
oauthScope = "openid profile email address phone" | ||
oauthThresholdSeconds = 0 | ||
} | ||
service { | ||
authServiceName = "WebAuthn" | ||
} | ||
} | ||
|
||
val forgeblock = FROptionsBuilder.build { | ||
server { | ||
url = "https://openam-sdks.forgeblocks.com/am" | ||
realm = "alpha" | ||
cookieName = "5421aeddf91aa20" | ||
timeout = 50 | ||
} | ||
oauth { | ||
oauthClientId = "AndroidTest" | ||
oauthRedirectUri = "org.forgerock.demo:/oauth2redirect" | ||
//oauthRedirectUri = "https://idc.petrov.ca/oauth2redirect" | ||
oauthCacheSeconds = 0 | ||
oauthScope = "openid profile email address phone fr:idm:*" | ||
oauthThresholdSeconds = 0 | ||
} | ||
service { | ||
authServiceName = "WebAuthn" | ||
} | ||
/* | ||
store { | ||
//Default use SecureSharedPreferences | ||
//oidcStorage = TokenStorage(ContextProvider.context) | ||
//ssoTokenStorage = SSOTokenStorage(ContextProvider.context) | ||
//cookiesStorage = CookiesStorage(ContextProvider.context) | ||
oidcStorage = loadTokenStorage(ContextProvider.context) | ||
ssoTokenStorage = loadSSOTokenStorage(ContextProvider.context) | ||
cookiesStorage = loadCookiesStorage(ContextProvider.context) | ||
} | ||
*/ | ||
} | ||
|
||
val pingOidc = FROptionsBuilder.build { | ||
server { | ||
url = "https://auth.pingone.ca/02fb4743-189a-4bc7-9d6c-a919edfe6447/as" | ||
} | ||
oauth { | ||
oauthClientId = "2dde00e2-3dd5-42b1-96e9-ad17e29f4bbd" | ||
oauthRedirectUri = "org.forgerock.demo://oauth2redirect" | ||
oauthScope = "openid email address phone profile revoke" | ||
//oauthSignOutRedirectUri = "org.forgerock.demo://oauth2redirect" | ||
} | ||
} | ||
|
||
var current by mutableStateOf(dbind) | ||
private set | ||
|
||
init { | ||
servers.add(localhost) | ||
servers.add(dbind) | ||
servers.add(sdk) | ||
servers.add(local) | ||
servers.add(ops) | ||
servers.add(forgeblock) | ||
servers.add(pingOidc) | ||
} | ||
|
||
fun select(context: Context, options: FROptions) { | ||
if(options.server.url.contains("pingone")) { | ||
viewModelScope.launch { | ||
val option = | ||
options.discover(options.server.url + "/.well-known/openid-configuration") | ||
FRAuth.start(context, option) | ||
} | ||
} | ||
else { | ||
FRAuth.start(context, options) | ||
} | ||
current = options | ||
} | ||
|
||
fun select(context: Context, host: String) { | ||
servers.find { | ||
it.server.url == host | ||
}?.let { | ||
select(context, it) | ||
} ?: run { | ||
select(context, dbind) | ||
} | ||
} | ||
|
||
fun getAll(): List<FROptions> { | ||
return servers | ||
} | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
139 changes: 0 additions & 139 deletions
139
samples/app/src/main/java/com/example/app/env/EnvViewModel.kt
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.