public Principal authenticate(String username, String password) throws SecurityException { String passwd = users.get(username); if (passwd == null) throw new SecurityException(Messages.MESSAGES.userIsNotRegistered(username)); if (!passwd.equals(password)) throw new SecurityException(Messages.MESSAGES.wrongPassword(username)); return new SimplePrincipal(username); }
public Principal authenticate(String username, String password) throws SecurityException { String passwd = users.get(username); if (passwd == null) throw new SecurityException("User is not registered: " + username); if (!passwd.equals(password)) throw new SecurityException("Wrong password for: " + username); return new SimplePrincipal(username); }
public Principal authenticate(String username, String password) throws SecurityException { String passwd = users.get(username); if (passwd == null) throw new SecurityException(Messages.MESSAGES.userIsNotRegistered(username)); if (!passwd.equals(password)) throw new SecurityException(Messages.MESSAGES.wrongPassword(username)); return new SimplePrincipal(username); }
public Principal authenticate(String username, String password) throws SecurityException { String passwd = users.get(username); if (passwd == null) throw new SecurityException(Messages.MESSAGES.userIsNotRegistered(username)); if (!passwd.equals(password)) throw new SecurityException(Messages.MESSAGES.wrongPassword(username)); return new SimplePrincipal(username); }
protected void authenticate(ContainerRequestContext ctx) throws IOException { Principal principal = new SimplePrincipal("Sample" + System.currentTimeMillis()); ctx.setSecurityContext( new NettySecurityContext(principal, null, "BASIC", true) ); } }