if (semiColonPos <= 0) {
throw AuthenticationException.newBuilder()
.setSource(Source.local(Method.BASIC))
- .setMessage("decoded basic auth does not contain ':'")
+ .setMessage("Decoded basic auth does not contain ':'")
.build();
}
String login = basicAuthDecoded.substring(0, semiColonPos);
@CheckForNull
private static String checkCsrf(@Nullable String csrfState, @Nullable String stateInHeader) {
if (isBlank(csrfState)) {
- return "missing reference CSRF value";
+ return "Missing reference CSRF value";
}
if (!StringUtils.equals(csrfState, stateInHeader)) {
- return "wrong CSFR in request";
+ return "Wrong CSFR in request";
}
return null;
}
throw AuthenticationException.newBuilder()
.setSource(realmEventSource(method))
.setLogin(userLogin)
- .setMessage("realm returned authenticate=false")
+ .setMessage("Realm returned authenticate=false")
.build();
}
UserDto userDto = synchronize(userLogin, details, request, method);
throw AuthenticationException.newBuilder()
.setSource(source)
.setLogin(user.getLogin())
- .setMessage("user signup disabled for provider '" + provider.getKey() + "'")
+ .setMessage("User signup disabled for provider '" + provider.getKey() + "'")
.setPublicMessage(format("'%s' users are not allowed to sign up", provider.getKey()))
.build();
}
throw AuthenticationException.newBuilder()
.setSource(source)
.setLogin(user.getLogin())
- .setMessage(format("email '%s' is already used", email))
+ .setMessage(format("Email '%s' is already used", email))
.setPublicMessage(format(
"You can't sign up because email '%s' is already used by an existing user. This means that you probably already registered with another account.",
email))
throw AuthenticationException.newBuilder()
.setSource(Source.local(Method.FORM))
.setLogin(login)
- .setMessage("empty login and/or password")
+ .setMessage("Empty login and/or password")
.build();
}
return credentialsAuthenticator.authenticate(login, password, request, Method.FORM);
mockPostJavaWsRequest();
thrown.expect(authenticationException().from(Source.local(Method.JWT)).withLogin(LOGIN).andNoPublicMessage());
- thrown.expectMessage("wrong CSFR in request");
+ thrown.expectMessage("Wrong CSFR in request");
underTest.verifyState(request, CSRF_STATE, LOGIN);
}
mockPostJavaWsRequest();
thrown.expect(authenticationException().from(Source.local(Method.JWT)).withLogin(LOGIN).andNoPublicMessage());
- thrown.expectMessage("missing reference CSRF value");
+ thrown.expectMessage("Missing reference CSRF value");
underTest.verifyState(request, null, LOGIN);
}
mockPostJavaWsRequest();
thrown.expect(authenticationException().from(Source.local(Method.JWT)).withLogin(LOGIN).andNoPublicMessage());
- thrown.expectMessage("missing reference CSRF value");
+ thrown.expectMessage("Missing reference CSRF value");
underTest.verifyState(request, "", LOGIN);
}
when(request.getMethod()).thenReturn("POST");
thrown.expect(authenticationException().from(Source.local(Method.JWT)).withLogin(LOGIN).andNoPublicMessage());
- thrown.expectMessage("wrong CSFR in request");
+ thrown.expectMessage("Wrong CSFR in request");
underTest.verifyState(request, CSRF_STATE, LOGIN);
}
when(request.getMethod()).thenReturn("PUT");
thrown.expect(authenticationException().from(Source.local(Method.JWT)).withLogin(LOGIN).andNoPublicMessage());
- thrown.expectMessage("wrong CSFR in request");
+ thrown.expectMessage("Wrong CSFR in request");
underTest.verifyState(request, CSRF_STATE, LOGIN);
}
when(request.getMethod()).thenReturn("DELETE");
thrown.expect(authenticationException().from(Source.local(Method.JWT)).withLogin(LOGIN).andNoPublicMessage());
- thrown.expectMessage("wrong CSFR in request");
+ thrown.expectMessage("Wrong CSFR in request");
underTest.verifyState(request, CSRF_STATE, LOGIN);
}
when(authenticator.doAuthenticate(any(Authenticator.Context.class))).thenReturn(false);
expectedException.expect(authenticationException().from(Source.realm(BASIC, REALM_NAME)).withLogin(LOGIN).andNoPublicMessage());
- expectedException.expectMessage("realm returned authenticate=false");
+ expectedException.expectMessage("Realm returned authenticate=false");
try {
underTest.authenticate(LOGIN, PASSWORD, request, BASIC);
} finally {
Source source = Source.realm(Method.FORM, identityProvider.getName());
thrown.expect(authenticationException().from(source).withLogin(USER_IDENTITY.getLogin()).andPublicMessage("'github' users are not allowed to sign up"));
- thrown.expectMessage("user signup disabled for provider 'github'");
+ thrown.expectMessage("User signup disabled for provider 'github'");
underTest.authenticate(USER_IDENTITY, identityProvider, source);
}
.withLogin(USER_IDENTITY.getLogin())
.andPublicMessage("You can't sign up because email 'john@email.com' is already used by an existing user. " +
"This means that you probably already registered with another account."));
- thrown.expectMessage("email 'john@email.com' is already used");
+ thrown.expectMessage("Email 'john@email.com' is already used");
underTest.authenticate(USER_IDENTITY, IDENTITY_PROVIDER, source);
}