Skip to content

Commit

Permalink
ADST-566 (#86)
Browse files Browse the repository at this point in the history
* Integrate Auth0 using app auth

* Integrate Auth0 using app auth

* added check for the scope

* optmize code

* fixed code error

* udpate condition for keycloak
  • Loading branch information
aman-alfresco authored Dec 9, 2024
1 parent 1aa345c commit b580258
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
7 changes: 7 additions & 0 deletions auth/src/main/java/com/alfresco/auth/AuthConfig.kt
Original file line number Diff line number Diff line change
Expand Up @@ -75,3 +75,10 @@ enum class AuthTypeProvider {
NEW_IDP,
NONE;
}

enum class IdentityProvider {
KEYCLOAK,
AUTH0;

fun value() = name.lowercase()
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import com.alfresco.auth.AuthInterceptor
import com.alfresco.auth.AuthType
import com.alfresco.auth.Credentials
import com.alfresco.auth.DiscoveryService
import com.alfresco.auth.IdentityProvider
import com.alfresco.auth.data.LiveEvent
import com.alfresco.auth.data.MutableLiveEvent
import com.alfresco.auth.data.OAuth2Data
Expand Down Expand Up @@ -55,10 +56,9 @@ abstract class AuthenticationViewModel : ViewModel() {
discoveryService = DiscoveryService(context, authConfig)

val oAuth2Data = checkAppConfigOAuthType(discoveryService, endpoint)
val clientID = oAuth2Data?.clientId
val secret = oAuth2Data?.secret
val authType = oAuth2Data?.authType

if (clientID == "alfresco" && secret.isNullOrEmpty()) {
if (authType.isNullOrEmpty() || authType.lowercase() == IdentityProvider.KEYCLOAK.value()) {
val authType = withContext(Dispatchers.IO) { discoveryService.getAuthType(endpoint) }
onResult(authType, oAuth2Data)
} else {
Expand Down

0 comments on commit b580258

Please sign in to comment.