Skip to content

Commit 936b42d

Browse files
author
Thomas
committed
add switch variable for selecting account on genericoauth
1 parent c6e4cad commit 936b42d

File tree

4 files changed

+7
-4
lines changed

4 files changed

+7
-4
lines changed

server/api-service/lowcoder-sdk/src/main/java/org/lowcoder/sdk/auth/Oauth2GenericAuthConfig.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,15 @@ public class Oauth2GenericAuthConfig extends Oauth2SimpleAuthConfig {
2626
private String scope;
2727
private HashMap<String, String> sourceMappings;
2828
private Boolean userInfoIntrospection;
29+
private Boolean userCanSelectAccounts;
2930

3031
@Override
3132
public String replaceAuthUrlClientIdPlaceholder(String url)
3233
{
3334
return super.replaceAuthUrlClientIdPlaceholder(url)
3435
.replace(BASE_URL_PLACEHOLDER, authorizationEndpoint)
35-
.replace(SCOPE_PLACEHOLDER, scope);
36+
.replace(SCOPE_PLACEHOLDER, scope)
37+
.concat(Boolean.TRUE.equals(userCanSelectAccounts)?"&prompt=select_account":"");
3638
}
3739

3840

server/api-service/lowcoder-sdk/src/main/java/org/lowcoder/sdk/auth/constants/Oauth2Constants.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,5 @@ public class Oauth2Constants {
4848
+ "&redirect_uri=" + REDIRECT_URL_PLACEHOLDER
4949
+ "&state=" + STATE_PLACEHOLDER
5050
+ "&scope=" + SCOPE_PLACEHOLDER
51-
+ "&access_type=offline"
52-
+ "&prompt=select_account";
51+
+ "&access_type=offline";
5352
}

server/api-service/lowcoder-server/src/main/java/org/lowcoder/api/authentication/service/factory/AuthConfigFactoryImpl.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,8 @@ private Oauth2SimpleAuthConfig buildOauth2GenericAuthConfig(AuthConfigRequest au
117117
.userInfoEndpoint(authConfigRequest.getUserInfoEndpoint())
118118
.scope(authConfigRequest.getScope())
119119
.authType(AuthTypeConstants.GENERIC)
120-
.userInfoIntrospection(MapUtils.getBoolean(authConfigRequest,"userInfoIntrospection", false))
120+
.userInfoIntrospection(MapUtils.getBoolean(authConfigRequest,"userInfoIntrospection"))
121+
.userCanSelectAccounts(MapUtils.getBoolean(authConfigRequest,"userCanSelectAccounts"))
121122
.build();
122123
}
123124
}

server/api-service/lowcoder-server/src/test/java/org/lowcoder/api/authentication/GenericAuthenticateTest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ public void testGoogleLoginSuccess(WireMockRuntimeInfo wmRuntimeInfo) {
8888
.scope("scope")
8989
.sourceMappings(sourceMappings)
9090
.userInfoIntrospection(true)
91+
.userCanSelectAccounts(true)
9192
.build();
9293

9394
var organization = Organization.builder().build();

0 commit comments

Comments
 (0)