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

feat: sso implementation #2523

Open
wants to merge 83 commits into
base: sso
Choose a base branch
from
Open

feat: sso implementation #2523

wants to merge 83 commits into from

Conversation

huglx
Copy link
Collaborator

@huglx huglx commented Oct 6, 2024

What I have done:

  • adding SSO providers
  • logging via SSO
  • New users now become a member of the organization that issued the SSO provider
  • customized login page for self-hosted instances
  • started writing tests

What I plan to add:

  • collect the user's role that the organization set for them and grant these roles to the user
  • more test coverage
  • simplify adding a provider (there is a URL that calls .../well-known/openid-configuration, and through this URL, I can fetch all needed URLs)

tbc

@huglx
Copy link
Collaborator Author

huglx commented Oct 11, 2024

I have gone through all the change requests. I just have a question about the validation schema. I created SSO_PROVIDER in GlobalValidationSchema and added it to the form. Is this the correct way to do it? Or is there another way to do it?

On the weekend, I plan to write tests and documentation, so I hope it will be ready by Monday.

@JanCizmar
Copy link
Contributor

I have gone through all the change requests. I just have a question about the validation schema. I created SSO_PROVIDER in GlobalValidationSchema and added it to the form. Is this the correct way to do it? Or is there another way to do it?

On the weekend, I plan to write tests and documentation, so I hope it will be ready by Monday.

yes, that's correct approach.

@JanCizmar JanCizmar self-requested a review October 17, 2024 14:48
)
var customLogoUrl: String? =
"https://user-images.githubusercontent.com/18496315/188628892-33fcc282-26f1-4035-8105-95952bd93de9.svg",
"/favicon.svg",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should not be Tolgee Logo.

@@ -195,6 +195,26 @@ export const setTranslations = (
method: 'POST',
});

export const setSsoProvider = () => {
const sql = `insert into ee.tenant (id, organization_id, domain, client_id, client_secret, authorization_uri,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why don't you create test data for this?

@@ -31,6 +35,22 @@ context('Login', () => {
cy.gcy('global-language-menu').should('be.visible');
});

context('Test Suite for SSO Login', () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
context('Test Suite for SSO Login', () => {
context('SSO Login', () => {

@@ -163,7 +152,7 @@ class OAuthService(
domain = tenant.domain,
organizationId = tenant.organizationId,
)
val user = oAuthUserHandler.findOrCreateUser(userData, invitationCode, tenant.domain)
val user = oAuthUserHandler.findOrCreateUser(userData, invitationCode, "sso")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Search only for users with the same SSO domain.

val response = oAuthMultiTenantsMocks.authorize("registrationId")
assertThat(response.response.status).isEqualTo(200)
val result = jacksonObjectMapper().readValue(response.response.contentAsString, HashMap::class.java)
Assertions.assertThat(result["accessToken"]).isNotNull
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use result["accessToken"].assert.isNotNull syntax

).thenReturn(defaultTokenResponse)
).thenReturn(tokenResponse)

// mock parsing of jwt
mockJwk()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be called mockJwt

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

Successfully merging this pull request may close these issues.

Add SSO feature to Cloud and Self-hosted
2 participants