Skip to content

Commit

Permalink
Rollback SDKS-3420 Hide Environment information from Sample App
Browse files Browse the repository at this point in the history
  • Loading branch information
witrisna committed Sep 11, 2024
1 parent 610292d commit c47c186
Showing 1 changed file with 129 additions and 10 deletions.
139 changes: 129 additions & 10 deletions samples/app/src/main/java/com/example/app/env/EnvViewModel.kt
Original file line number Diff line number Diff line change
Expand Up @@ -26,36 +26,155 @@ class EnvViewModel : ViewModel() {

val servers = mutableListOf<FROptions>()

val server = FROptionsBuilder.build {
val localhost = FROptionsBuilder.build {
server {
url = "https://<ServerURL>/openam"
url = "https://auth.pingone.ca/02fb4743-189a-4bc7-9d6c-a919edfe6447/as"
realm = "alpha"
cookieName = "<cookieName>"
cookieName = "c1c805de4c9b333"
timeout = 50
}
oauth {
oauthClientId = "<ClientID>"
oauthRedirectUri = "<RedirectURI>"
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 = "Login"
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"
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"
oauthCacheSeconds = 0
oauthScope = "openid profile email address phone"
oauthThresholdSeconds = 0
}
service {
authServiceName = "WebAuthn"
}
store {
// Override the default storage
//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 = "c12743f9-08e8-4420-a624-71bbb08e9fe1"
oauthRedirectUri = "org.forgerock.demo://oauth2redirect"
oauthScope = "openid email address phone profile revoke"
}
}

var current by mutableStateOf(server)
var current by mutableStateOf(dbind)
private set

init {
servers.add(server)
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) {
Expand All @@ -78,7 +197,7 @@ class EnvViewModel : ViewModel() {
}?.let {
select(context, it)
} ?: run {
select(context, server)
select(context, dbind)
}
}

Expand Down

0 comments on commit c47c186

Please sign in to comment.