From 895b2a35c3ce9d7d852dd3218057f516ca9d7388 Mon Sep 17 00:00:00 2001 From: Mohit Yadav <105265192+mohityadav766@users.noreply.github.com> Date: Tue, 4 Oct 2022 13:03:31 +0530 Subject: [PATCH] [ BasicAuth] remove auth on registration (#7915) * Fix Version issue b/w api/v1/version and entity {id}/versions * [UserResource] remove auth on user registration * Fix Smtp settings Co-authored-by: mohitdeuex <105265192+mohitdeuex@users.noreply.github.com> --- .../service/resources/teams/UserResource.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/resources/teams/UserResource.java b/openmetadata-service/src/main/java/org/openmetadata/service/resources/teams/UserResource.java index fdac36fcdcb..7f5dee9dd13 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/resources/teams/UserResource.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/resources/teams/UserResource.java @@ -181,10 +181,9 @@ public class UserResource extends EntityResource { ConfigurationHolder.getInstance() .getConfig(ConfigurationHolder.ConfigurationType.AUTHENTICATION_CONFIG, AuthenticationConfiguration.class) .getProvider(); - this.isEmailServiceEnabled = - ConfigurationHolder.getInstance() - .getConfig(ConfigurationType.SMTP_CONFIG, SmtpSettings.class) - .getEnableSmtpServer(); + SmtpSettings smtpSettings = + ConfigurationHolder.getInstance().getConfig(ConfigurationType.SMTP_CONFIG, SmtpSettings.class); + this.isEmailServiceEnabled = smtpSettings != null && smtpSettings.getEnableSmtpServer(); this.loginAttemptCache = new LoginAttemptCache(); } @@ -1223,7 +1222,10 @@ public class UserResource extends EntityResource { .contains(userName)) { newUser.setIsAdmin(true); } - return dao.create(uriInfo, newUser); + // remove auth mechanism from the user + User registeredUser = dao.create(uriInfo, newUser); + registeredUser.setAuthenticationMechanism(null); + return registeredUser; } public void confirmEmailRegistration(UriInfo uriInfo, String emailToken) throws IOException {