Skip to content
Permalink
Browse files
retrofitted password field
  • Loading branch information
mgeiss committed Jun 14, 2017
1 parent 0230a24 commit 2d7e458f327315c47968a469e652fbf2b8008d41
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
@@ -18,7 +18,7 @@
public class TellerAuthentication {

private String employeeIdentifier;
private byte[] password;
private String password;

public TellerAuthentication() {
super();
@@ -32,11 +32,11 @@ public void setEmployeeIdentifier(final String employeeIdentifier) {
this.employeeIdentifier = employeeIdentifier;
}

public byte[] getPassword() {
public String getPassword() {
return this.password;
}

public void setPassword(final byte[] password) {
public void setPassword(final String password) {
this.password = password;
}
}
@@ -46,7 +46,7 @@ public void shouldAuthenticate() throws Exception {

final TellerAuthentication tellerAuthentication = new TellerAuthentication();
tellerAuthentication.setEmployeeIdentifier(AbstractTellerTest.TEST_USER);
tellerAuthentication.setPassword(teller.getPassword().getBytes());
tellerAuthentication.setPassword(teller.getPassword());

final String auth = super.testSubject.auth(teller.getCode(), tellerAuthentication);

@@ -60,7 +60,7 @@ public void shouldNotAuthenticateUserMismatch() throws Exception {

final TellerAuthentication tellerAuthentication = new TellerAuthentication();
tellerAuthentication.setEmployeeIdentifier("unassigneduser");
tellerAuthentication.setPassword(teller.getPassword().getBytes());
tellerAuthentication.setPassword(teller.getPassword());

super.testSubject.auth(teller.getCode(), tellerAuthentication);
}
@@ -71,7 +71,7 @@ public void shouldNotAuthenticatePasswordMismatch() throws Exception {

final TellerAuthentication tellerAuthentication = new TellerAuthentication();
tellerAuthentication.setEmployeeIdentifier(AbstractTellerTest.TEST_USER);
tellerAuthentication.setPassword("wrongpasword".getBytes());
tellerAuthentication.setPassword("wrongpasword");

super.testSubject.auth(teller.getCode(), tellerAuthentication);
}
@@ -82,7 +82,7 @@ public void shouldPauseTeller() throws Exception {

final TellerAuthentication tellerAuthentication = new TellerAuthentication();
tellerAuthentication.setEmployeeIdentifier(AbstractTellerTest.TEST_USER);
tellerAuthentication.setPassword(teller.getPassword().getBytes());
tellerAuthentication.setPassword(teller.getPassword());

super.testSubject.auth(teller.getCode(), tellerAuthentication);

@@ -106,7 +106,7 @@ public void shouldOpenAccount() throws Exception {

final TellerAuthentication tellerAuthentication = new TellerAuthentication();
tellerAuthentication.setEmployeeIdentifier(AbstractTellerTest.TEST_USER);
tellerAuthentication.setPassword(teller.getPassword().getBytes());
tellerAuthentication.setPassword(teller.getPassword());

super.testSubject.auth(teller.getCode(), tellerAuthentication);

@@ -137,7 +137,7 @@ public void shouldCloseAccount() throws Exception {

final TellerAuthentication tellerAuthentication = new TellerAuthentication();
tellerAuthentication.setEmployeeIdentifier(AbstractTellerTest.TEST_USER);
tellerAuthentication.setPassword(teller.getPassword().getBytes());
tellerAuthentication.setPassword(teller.getPassword());

super.testSubject.auth(teller.getCode(), tellerAuthentication);

@@ -168,7 +168,7 @@ public void shouldTransferAccountToAccount() throws Exception {

final TellerAuthentication tellerAuthentication = new TellerAuthentication();
tellerAuthentication.setEmployeeIdentifier(AbstractTellerTest.TEST_USER);
tellerAuthentication.setPassword(teller.getPassword().getBytes());
tellerAuthentication.setPassword(teller.getPassword());

super.testSubject.auth(teller.getCode(), tellerAuthentication);

@@ -202,7 +202,7 @@ public void shouldDeposit() throws Exception {

final TellerAuthentication tellerAuthentication = new TellerAuthentication();
tellerAuthentication.setEmployeeIdentifier(AbstractTellerTest.TEST_USER);
tellerAuthentication.setPassword(teller.getPassword().getBytes());
tellerAuthentication.setPassword(teller.getPassword());

super.testSubject.auth(teller.getCode(), tellerAuthentication);

@@ -233,7 +233,7 @@ public void shouldWithdraw() throws Exception {

final TellerAuthentication tellerAuthentication = new TellerAuthentication();
tellerAuthentication.setEmployeeIdentifier(AbstractTellerTest.TEST_USER);
tellerAuthentication.setPassword(teller.getPassword().getBytes());
tellerAuthentication.setPassword(teller.getPassword());

super.testSubject.auth(teller.getCode(), tellerAuthentication);

@@ -224,7 +224,7 @@ public String process(final AuthenticateTellerCommand authenticateTellerCommand)
throw ServiceException.notFound("Teller {0} not found.", tellerCode);
}

final byte[] givenPassword = this.hashGenerator.hash(new String(tellerAuthentication.getPassword()),
final byte[] givenPassword = this.hashGenerator.hash(tellerAuthentication.getPassword(),
Base64Utils.decodeFromString(tellerEntity.getSalt()), ServiceConstants.ITERATION_COUNT, ServiceConstants.LENGTH);

if (!tellerEntity.getPassword().equals(Base64Utils.encodeToString(givenPassword))) {

0 comments on commit 2d7e458

Please sign in to comment.