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

Unable to integrate Keycloack SSO in cortex #464

Open
yogeshgurjar127 opened this issue Mar 1, 2024 · 6 comments
Open

Unable to integrate Keycloack SSO in cortex #464

yogeshgurjar127 opened this issue Mar 1, 2024 · 6 comments

Comments

@yogeshgurjar127
Copy link

yogeshgurjar127 commented Mar 1, 2024

Hello Team,

When trying to use single sign-on for Cortex this error message appears in the logs:

image

Below is my configuration file.

oauth {
name: oauth2
clientId: "cortex"
clientSecret: "Secret"
redirectUri: "http://localhost:9001/api/ssoLogin"
responseType: "code"
grantType: "authorization_code"
authorizationUrl: "http://X.X.X.X:8080/realms/openid/protocol/openid-connect/auth"
authorizationHeader: "Bearer"
tokenUrl: "http://X.X.X.X::8080/realms/openid/protocol/openid-connect/token"
userUrl: "http://X.X.X.X::8080/realms/openid/protocol/openid-connect/userinfo"
#scope: ["openid", "email"]
scope: "read:user"
userIdField: "email"
}

# Single-Sign On
sso {
    # Autocreate user in database?
    autocreate = true

    # Autoupdate its profile and roles?
    #autoupdate = false

    # Autologin user using SSO?
    autologin = true
    #defaultRoles = []

    # Name of mapping class from user resource to backend user ('simple' or 'group')
    mapper = group
    attributes {
      login = "[email protected]"
      name = "admin"
      groups = "groups"
      organization = "test"
    }
    defaultRoles = ["read"]
    auth.sso.defaultOrganization = "test"
    auth.sso.attributes.organization= "test"
    groups {
      mappings {
        admin-profile-name = ["admin"]
        editor-profile-name = ["write"]
        reader-profile-name = ["read"]
      }
    }

    mapper = testing
    attributes {
      login = "user"
      name = "name"
      roles = "read,analyze,orgadmin"
      organization = "test"
    }
    defaultRoles = ["read"]
    auth.sso.defaultOrganization = "test"
    auth.sso.attributes.organization= "test"
}

}

Could you please point me in the right direction for configuration guidance?

Thanks in advance!

Work Environment

Question Answer
OS version (server) Ubuntu
OS version (client) 22
Cortex version / git hash 3.1.8-1
Package Type From source
Browser type & version Chrome

@To-om Can you please help me with this?

@To-om
Copy link
Contributor

To-om commented Mar 6, 2024

In the OAuth2 configuration the scope must be an array:

-scope: "read:user"
+scope: ["read:user"]

@yogeshgurjar127
Copy link
Author

yogeshgurjar127 commented Mar 11, 2024

Hello @To-om

I adjusted the scope in the configuration file, however now I am getting the below error. For your convenience, the error message is provided below.

{"type":"AuthenticationError","message":"Authentication failure"}

image

Can you please help me with this?

@To-om
Copy link
Contributor

To-om commented Mar 11, 2024

The scope seems to be incorrect. Check the documentation of your IdP and set the expected value. Have you tried the default value: scope: ["openid", "email"] ?

@yogeshgurjar127
Copy link
Author

yogeshgurjar127 commented Mar 11, 2024

@To-om Yes, I already tried the default value of scope but still getting the same error.

Please find below conf details.

oauth2 {
clientId: "cortex"
clientSecret: "NnLadsgsgvssttlUzJKX4TnJS"
redirectUri: "http://localhost:9001/api/ssoLogin"
responseType: "code"
grantType: "authorization_code"
authorizationUrl: "http://X.X.X.X:8080/auth/realms/openid/protocol/openid-connect/auth"
authorizationHeader: "Bearer"
tokenUrl: "http://X.X.X.X:8080/auth/realms/openid/protocol/openid-connect/token"
userUrl: "http://X.X.X.X:8080/auth/realms/openid/protocol/openid-connect/userinfo"
#scope: ["read:user"]
scope: ["openid", "email"]
userIdField: "email"
}
}

@yogeshgurjar127
Copy link
Author

@To-om Could you please assist me with this?

@yogeshgurjar127
Copy link
Author

Hello @To-om

Could you please update on this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants