@Override protected String getPassword(String username) { GenericPrincipal principal = principals.get(username); return principal == null ? null : principal.getPassword(); }
void addUser(String username, String password) { principals.put(username, new GenericPrincipal(username, password, Collections.singletonList(AUTH_ROLE))); }
realm = new NullRealm();
/** * Get the principal associated with the specified user. * @param username The user name * @return the Principal associated with the given user name. */ @Override protected synchronized Principal getPrincipal(String username) { return new GenericPrincipal(username, getPassword(username), getRoles(username)); }
/** * Return the Principal associated with the given user name. */ protected synchronized Principal getPrincipal(DirContext context, String username) throws NamingException { User user = getUser(context, username); return new GenericPrincipal(this, user.username, user.password , getRoles(context, user)); }
/** * @return the <code>Principal</code> associated with the given user name. */ @Override protected Principal getPrincipal(String username) { return authenticate(username, new JAASCallbackHandler(this, username, null, null, null, null, null, null, null, HttpServletRequest.CLIENT_CERT_AUTH)); }
protected Principal getPrincipal(String username, GSSCredential gssCredential) { Principal p = getPrincipal(username); if (p instanceof GenericPrincipal) { ((GenericPrincipal) p).setGssCredential(gssCredential); } return p; }
container.setCatalinaHome(catalinaHome); container.setRealm(new MemoryRealm());
/** * Gracefully shut down active use of the public methods of this Component. * * @exception LifecycleException if this component detects a fatal error * that needs to be reported */ public void stop() throws LifecycleException { // Perform normal superclass finalization super.stop(); // Close any open DB connection close(this.dbConnection); }
/** * Return the Principal associated with the given user name. */ @Override protected synchronized Principal getPrincipal(String username) { return (new GenericPrincipal(username, getPassword(username), getRoles(username))); }
/** * Return the <code>Principal</code> associated with the given user name. */ @Override protected Principal getPrincipal(String username) { return authenticate(username, new JAASCallbackHandler(this, username, null, null, null, null, null, null, null, HttpServletRequest.CLIENT_CERT_AUTH)); }
protected Principal getPrincipal(String username, GSSCredential gssCredential) { Principal p = getPrincipal(username); if (p instanceof GenericPrincipal) { ((GenericPrincipal) p).setGssCredential(gssCredential); } return p; }
@Override public Principal authenticate(String username, String credentials) { GenericPrincipal principal = principals.get(username); boolean validated = principal != null && getCredentialHandler().matches(credentials, principal.getPassword()); return validated ? principal : null; }
container.setRealm(new MemoryRealm());
/** * Returns the {@link Engine} of the specified Tomcat {@link Service}. If the {@link Service} has no * {@link Engine} set, a new {@link Engine} will be created and set. * * <p>The return type of {@link Service#getContainer()} has been changed from {@link Container} to * {@link Engine} since 8.5. Calling it directly will cause {@link NoSuchMethodError}. */ static Engine engine(Service service, String hostname) { final Engine engine; try { final Method m = Service.class.getDeclaredMethod("getContainer"); engine = (Engine) m.invoke(service); } catch (Exception e) { throw new Error("failed to invoke Service.getContainer()", e); } if (engine != null) { return engine; } // Create a new engine. final Engine newEngine = new StandardEngine(); newEngine.setName("Tomcat"); newEngine.setDefaultHost(hostname); newEngine.setRealm(new NullRealm()); service.setContainer(newEngine); return newEngine; }
/** * Return the Principal associated with the given user name. */ @Override protected synchronized Principal getPrincipal(String username) { return (new GenericPrincipal(username, getPassword(username), getRoles(username))); }
/** * Return the <code>Principal</code> associated with the given user name. */ @Override protected Principal getPrincipal(String username) { return authenticate(username, new JAASCallbackHandler(this, username, null, null, null, null, null, null, null, Constants.CERT_METHOD)); }
protected Principal getPrincipal(String username, GSSCredential gssCredential) { Principal p = getPrincipal(username); if (p instanceof GenericPrincipal) { ((GenericPrincipal) p).setGssCredential(gssCredential); } return p; }
/** * Return the Principal associated with the given user name. */ @Override protected synchronized Principal getPrincipal(String username) { return (new GenericPrincipal(username, getPassword(username), getRoles(username))); }
/** * Return the <code>Principal</code> associated with the given user name. */ @Override protected Principal getPrincipal(String username) { return authenticate(username, new JAASCallbackHandler(this, username, null, null, null, null, null, null, null, HttpServletRequest.CLIENT_CERT_AUTH)); }