-
-
Notifications
You must be signed in to change notification settings - Fork 10.2k
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
OidcLocalUserService throw an Exception when executing createLocalUser in OIDC profile #5129
Comments
The issue you're encountering with To address this, you should:
The method If after verifying the OIDC provider configuration and your application's request for the email scope the problem persists, it might indicate a need to debug the application further to understand why the email attribute is not being correctly processed or populated. Sources
|
It is not up to UserDetails user = new User(newUserInfo.getUserId(),
this.placeholderDelegatingPasswordEncoder.encode(""), authorities); The object |
The root cause of the To address this, you have a couple of options:
Given the structure of your application and the constraints of your database, the first option might be more aligned with ensuring data integrity and consistency. It would require a closer look at how Sources
|
Yeah,and the problem also exists in the |
To resolve the issue with Here's a brief outline of what you could do:
Here is a conceptual example of how the adjusted @Transactional(rollbackFor = Exception.class)
@Override
public void createLocalUser(UserInfo newUserInfo) {
CustomUserDetails user = new CustomUserDetails(newUserInfo.getUserId(),
this.placeholderDelegatingPasswordEncoder.encode(""), newUserInfo.getEmail(), newUserInfo.getName(), authorities);
userDetailsManager.createUser(user);
this.updateUserInfoInternal(newUserInfo);
} In this example, Remember, this solution requires you to also adjust any other parts of your application that interact with Sources
|
@vdiskg are you aware of this issue? |
Describe the bug
A clear and concise description of what the bug is.
Recently,i try to debug apollo portal in order to understand how to implement authentication.However,I find a exception when
com.ctrip.framework.apollo.portal.spi.oidc.OidcLocalUserServiceImpl#createLocalUser
executing.In OIDC profile,
com.ctrip.framework.apollo.portal.spi.oidc.OidcAuthenticationSuccessEventListener
will listen the event calledAuthenticationSuccessEvent
which is from Spring Security.if person who is first time to login, it will executecom.ctrip.framework.apollo.portal.spi.oidc.OidcLocalUserServiceImpl#createLocalUser
to create user in database.Then the method will callJdbcUserDetailsManager#createUser
,which is configured incom.ctrip.framework.apollo.portal.spi.configuration.AuthConfiguration.SpringSecurityAuthAutoConfiguration#jdbcUserDetailsManager
,but the parameter does not contain email,which is set to non-null incom.ctrip.framework.apollo.portal.entity.po.UserPO
.So it cause a JdbcSQLIntegrityConstraintViolationException.Although I use the h2 database,I guess it's the same situation under MySQL because of the configuration in
com.ctrip.framework.apollo.portal.spi.configuration.AuthConfiguration.SpringSecurityAuthAutoConfiguration#jdbcUserDetailsManager
I would like to ask, is this a bug?
To Reproduce
Steps to reproduce the behavior:
com.ctrip.framework.apollo.portal.spi.oidc.OidcLocalUserServiceImpl#createLocalUser
Expected behavior
A clear and concise description of what you expected to happen.
I think it should not throw an exception and save the data correctly.
Screenshots
If applicable, add screenshots to help explain your problem.
Additional Details & Logs
The text was updated successfully, but these errors were encountered: