Skip to content
Snippets Groups Projects
Commit 7a6f80bb authored by cramakri's avatar cramakri
Browse files

Added more variety to the user names generated by the dummy authentication...

Added more variety to the user names generated by the dummy authentication service. These include non-ASCII characters.

SVN: 13482
parent 1b3e49fc
No related branches found
No related tags found
No related merge requests found
...@@ -26,10 +26,15 @@ import org.apache.commons.lang.StringUtils; ...@@ -26,10 +26,15 @@ import org.apache.commons.lang.StringUtils;
public final class DummyAuthenticationService implements IAuthenticationService public final class DummyAuthenticationService implements IAuthenticationService
{ {
final String[] firstNames =
{ "StŽphane", "GŸnter", "Elfriede", "Ryszard", "Karel", "Claude" };
final String[] lastNames =
{ "MallarmŽ", "Grass", "Jelinek", "Kapu\u015Bci\u0144ski", "\u010Capek", "LŽvi-Strauss" };
// //
// IAuthenticationService // IAuthenticationService
// //
public final String authenticateApplication() public final String authenticateApplication()
{ {
// Up to the contract, if it returns <code>null</code> here, it assumes that the application // Up to the contract, if it returns <code>null</code> here, it assumes that the application
...@@ -40,14 +45,22 @@ public final class DummyAuthenticationService implements IAuthenticationService ...@@ -40,14 +45,22 @@ public final class DummyAuthenticationService implements IAuthenticationService
/** /**
* Always returns <code>true</code>, meaning that the login was successful. * Always returns <code>true</code>, meaning that the login was successful.
*/ */
public final boolean authenticateUser(final String applicationToken, final String user, final String password) public final boolean authenticateUser(final String applicationToken, final String user,
final String password)
{ {
return true; return true;
} }
public final Principal getPrincipal(final String applicationToken, final String user) public final Principal getPrincipal(final String applicationToken, final String user)
{ {
return new Principal(user, "John", "Doe", "franz-josef.elmer@systemsx.ch"); // Generate a random first and last name combination
final String firstName;
final String lastName;
int idx = (int) Math.floor(Math.random() * firstNames.length);
firstName = firstNames[idx];
idx = (int) Math.floor(Math.random() * lastNames.length);
lastName = lastNames[idx];
return new Principal(user, firstName, lastName, "franz-josef.elmer@systemsx.ch");
} }
public final void check() public final void check()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment