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

auth creds are based on bundle key, not value #5260 #5306

Merged
merged 1 commit into from
Nov 16, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions src/main/java/edu/harvard/iq/dataverse/Shib.java
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,7 @@ public String confirmAndConvertAccount() {
logger.fine("builtin username: " + builtinUsername);
AuthenticatedUser builtInUserToConvert = authSvc.canLogInAsBuiltinUser(builtinUsername, builtinPassword);
if (builtInUserToConvert != null) {
// TODO: Switch from authSvc.convertBuiltInToShib to authSvc.convertBuiltInUserToRemoteUser
AuthenticatedUser au = authSvc.convertBuiltInToShib(builtInUserToConvert, shibAuthProvider.getId(), userIdentifier);
if (au != null) {
authSvc.updateAuthenticatedUser(au, displayInfo);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -781,11 +781,12 @@ public AuthenticatedUser canLogInAsBuiltinUser(String username, String password)

AuthenticationRequest authReq = new AuthenticationRequest();
/**
* @todo Should this really be coming from a bundle like this? Added
* because that's what BuiltinAuthenticationProvider does.
* @todo Should the credential key really be a Bundle key?
* BuiltinAuthenticationProvider.KEY_USERNAME_OR_EMAIL, for example, is
* "login.builtin.credential.usernameOrEmail" as of this writing.
*/
authReq.putCredential(BundleUtil.getStringFromBundle("login.builtin.credential.usernameOrEmail"), username);
authReq.putCredential(BundleUtil.getStringFromBundle("login.builtin.credential.password"), password);
authReq.putCredential(BuiltinAuthenticationProvider.KEY_USERNAME_OR_EMAIL, username);
authReq.putCredential(BuiltinAuthenticationProvider.KEY_PASSWORD, password);
/**
* @todo Should probably set IP address here.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,14 @@
public class BuiltinAuthenticationProvider implements CredentialsAuthenticationProvider {

public static final String PROVIDER_ID = "builtin";
private static final String KEY_USERNAME_OR_EMAIL = "login.builtin.credential.usernameOrEmail";
private static final String KEY_PASSWORD = "login.builtin.credential.password";
/**
* TODO: Think more about if it really makes sense to have the key for a
* credential be a Bundle key. What if we want to reorganize our Bundle
* files and rename some Bundle keys? Would login be broken until we update
* the strings below?
*/
public static final String KEY_USERNAME_OR_EMAIL = "login.builtin.credential.usernameOrEmail";
public static final String KEY_PASSWORD = "login.builtin.credential.password";
private static List<Credential> CREDENTIALS_LIST;

final BuiltinUserServiceBean bean;
Expand Down