Skip to content

Commit

Permalink
Merge pull request IQSS#5306 from IQSS/5260-account-conversion
Browse files Browse the repository at this point in the history
auth creds are based on bundle key, not value IQSS#5260
  • Loading branch information
kcondon authored Nov 16, 2018
2 parents 1e470bf + ade04c4 commit 086e60c
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
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

0 comments on commit 086e60c

Please sign in to comment.