Refine search
if (credentials != null) if (LOG.isDebugEnabled()) LOG.debug("Credentials: " + credentials); QuotedStringTokenizer tokenizer = new QuotedStringTokenizer(credentials, "=, ", true, false); final Digest digest = new Digest(request.getMethod()); if (domain == null) domain = "/"; response.setHeader(HttpHeader.WWW_AUTHENTICATE.asString(), "Digest realm=\"" + _loginService.getName() + "\", domain=\"" + domain
private void readObject(ObjectInputStream stream) throws IOException, ClassNotFoundException { stream.defaultReadObject(); SecurityHandler security=SecurityHandler.getCurrentSecurityHandler(); if (security==null) { if (LOG.isDebugEnabled()) LOG.debug("!SecurityHandler"); return; } LoginService login_service=security.getLoginService(); if (login_service==null) { if (LOG.isDebugEnabled()) LOG.debug("!LoginService"); return; } _userIdentity=login_service.login(_name,_credentials, null); LOG.debug("Deserialized and relogged in {}",this); }
getInitParameter(name)==null) setInitParameter(name,context.getInitParameter(name)); setLoginService(findLoginService()); if (_loginService!=null) unmanage(_loginService); setIdentityService(_loginService.getIdentityService()); if (_loginService.getIdentityService()==null) _loginService.setIdentityService(_identityService); else if (_loginService.getIdentityService()!=_identityService) throw new IllegalStateException("LoginService has different IdentityService to "+this); else if (_realmName!=null) LOG.warn("No Authenticator for "+this); throw new IllegalStateException("No Authenticator");
LOG.debug("jsecuritycheck {} {}",username,user); HttpSession session = request.getSession(false); if (user!=null) LOG.debug("authenticated {}->{}",form_auth,nuri); if (LOG.isDebugEnabled()) LOG.debug("Form authentication FAILED for " + StringUtil.printable(username)); if (_formErrorPage == null) !_loginService.validate(((Authentication.User)authentication).getUserIdentity())) LOG.debug("auth revoked {}",authentication);
public void logout(Authentication.User user) { LOG.debug("logout {}",user); LoginService login_service=getLoginService(); if (login_service!=null) { login_service.logout(user.getUserIdentity()); } IdentityService identity_service=getIdentityService(); if (identity_service!=null) { // TODO recover previous from threadlocal (or similar) Object previous=null; identity_service.disassociate(previous); } }
/** * @see org.eclipse.jetty.server.Authentication.Deferred#authenticate(javax.servlet.ServletRequest, javax.servlet.ServletResponse) */ @Override public Authentication authenticate(ServletRequest request, ServletResponse response) { try { LoginService login_service= _authenticator.getLoginService(); IdentityService identity_service=login_service.getIdentityService(); Authentication authentication = _authenticator.validateRequest(request,response,true); if (authentication instanceof Authentication.User && identity_service!=null) _previousAssociation=identity_service.associate(((Authentication.User)authentication).getUserIdentity()); return authentication; } catch (ServerAuthException e) { LOG.debug(e); } return this; }
if (name.startsWith("org.eclipse.jetty.security.") && getInitParameter(name)==null) setInitParameter(name,context.getInitParameter(name)); _loginService=findLoginService(); if (_loginService!=null) _loginServiceShared=true; _identityService=_loginService.getIdentityService(); _identityService=findIdentityService(); if (_loginService.getIdentityService()==null) _loginService.setIdentityService(_identityService); else if (_loginService.getIdentityService()!=_identityService) throw new IllegalStateException("LoginService has different IdentityService to "+this); LOG.warn("No ServerAuthentication for "+this); throw new IllegalStateException("No ServerAuthentication");
protected LoginService findLoginService() throws Exception { Collection<LoginService> list = getServer().getBeans(LoginService.class); LoginService service = null; String realm=getRealmName(); if (realm!=null) { for (LoginService s : list) if (s.getName()!=null && s.getName().equals(realm)) { service=s; break; } } else if (list.size()==1) service = list.iterator().next(); return service; }
/** * <p>Wraps a {@link LoginService} as an AuthorizationService</p> * * @param loginService the {@link LoginService} to wrap * @param credentials * @return an AuthorizationService that delegates the query for roles to the given {@link LoginService} */ public static AuthorizationService from(LoginService loginService, Object credentials) { return (request, name) -> loginService.login(name, credentials, request); } }
return Authentication.UNAUTHENTICATED; response.setHeader(HttpHeader.WWW_AUTHENTICATE.asString(), "basic realm=\"" + _loginService.getName() + '"'); response.sendError(HttpServletResponse.SC_UNAUTHORIZED); return Authentication.SEND_CONTINUE;
/** * @see org.eclipse.jetty.server.Authentication.Deferred#login(String, Object, ServletRequest) */ @Override public Authentication login(String username, Object password, ServletRequest request) { if (username == null) return null; UserIdentity identity = _authenticator.login(username, password, request); if (identity != null) { IdentityService identity_service = _authenticator.getLoginService().getIdentityService(); UserAuthentication authentication = new UserAuthentication("API",identity); if (identity_service != null) _previousAssociation=identity_service.associate(identity); return authentication; } return null; }
String password = credentials.substring(i+1); UserIdentity user = _loginService.login(username,password); if (user!=null) response.setHeader(HttpHeaders.WWW_AUTHENTICATE, AUTH_TYPE+" realm=\"" + _loginService.getName() + '"'); response.sendError(HttpServletResponse.SC_UNAUTHORIZED); return Authentication.SEND_CONTINUE;
!_loginService.validate(((Authentication.User)authentication).getUserIdentity()))
loginService.setIdentityService(identityService); jettyServer.addBean(loginService);
if (LOG.isDebugEnabled()) LOG.debug("Form authentication FAILED for " + StringUtil.printable(username)); if (_formErrorPage == null) !_loginService.validate(((Authentication.User)authentication).getUserIdentity())) LOG.debug("auth deferred {}",session.getId()); return Authentication.UNAUTHENTICATED;
public void logout(Authentication.User user) { LOG.debug("logout {}",user); LoginService login_service=getLoginService(); if (login_service!=null) { login_service.logout(user.getUserIdentity()); } IdentityService identity_service=getIdentityService(); if (identity_service!=null) { // TODO recover previous from threadlocal (or similar) Object previous=null; identity_service.disassociate(previous); } }
/** * @see org.eclipse.jetty.server.Authentication.Deferred#authenticate(ServletRequest) */ @Override public Authentication authenticate(ServletRequest request) { try { Authentication authentication = _authenticator.validateRequest(request,__deferredResponse,true); if (authentication!=null && (authentication instanceof Authentication.User) && !(authentication instanceof Authentication.ResponseSent)) { LoginService login_service= _authenticator.getLoginService(); IdentityService identity_service=login_service.getIdentityService(); if (identity_service!=null) _previousAssociation=identity_service.associate(((Authentication.User)authentication).getUserIdentity()); return authentication; } } catch (ServerAuthException e) { LOG.debug(e); } return this; }
if (name.startsWith("org.eclipse.jetty.security.") && getInitParameter(name)==null) setInitParameter(name,context.getInitParameter(name)); _loginService=findLoginService(); if (_loginService!=null) _loginServiceShared=true; _identityService=_loginService.getIdentityService(); _identityService=findIdentityService(); if (_loginService.getIdentityService()==null) _loginService.setIdentityService(_identityService); else if (_loginService.getIdentityService()!=_identityService) throw new IllegalStateException("LoginService has different IdentityService to "+this); LOG.warn("No ServerAuthentication for "+this); throw new IllegalStateException("No ServerAuthentication");
protected LoginService findLoginService() { List<LoginService> list = getServer().getBeans(LoginService.class); String realm=getRealmName(); if (realm!=null) { for (LoginService service : list) if (service.getName()!=null && service.getName().equals(realm)) return service; } else if (list.size()==1) return list.get(0); return null; }
public UserIdentity login(String username, Object password, ServletRequest servletRequest) { UserIdentity user = _loginService.login(username, password, servletRequest); if (user != null) { Request request = Request.getBaseRequest(servletRequest); renewSession(request, request == null ? null : request.getResponse()); return user; } return null; }