Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 //
 //  ========================================================================
 //  Copyright (c) 1995-2012 Mort Bay Consulting Pty. Ltd.
 //  ------------------------------------------------------------------------
 //  All rights reserved. This program and the accompanying materials
 //  are made available under the terms of the Eclipse Public License v1.0
 //  and Apache License v2.0 which accompanies this distribution.
 //
 //      The Eclipse Public License is available at
//      http://www.eclipse.org/legal/epl-v10.html
//
//      The Apache License v2.0 is available at
//      http://www.opensource.org/licenses/apache2.0.php
//
//  You may elect to redistribute this code under either of these licenses.
//  ========================================================================
//
package org.eclipse.jetty.security;
/* ------------------------------------------------------------ */
Associates UserIdentities from with threads and UserIdentity.Contexts.
public interface IdentityService
    final static String[] NO_ROLES = new String[]{}; 
    
    /* ------------------------------------------------------------ */
    
Associate a user identity with the current thread. This is called with as a thread enters the SecurityHandler.handle(java.lang.String,org.eclipse.jetty.server.Request,javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse) method and then again with a null argument as that call exits.

Parameters:
user The current user or null for no user to associated.
Returns:
an object representing the previous associated state
    
    /* ------------------------------------------------------------ */
    
Disassociate the user identity from the current thread and restore previous identity.

Parameters:
previous The opaque object returned from a call to associate(org.eclipse.jetty.server.UserIdentity)
    void disassociate(Object previous);
    /* ------------------------------------------------------------ */
    
Associate a runas Token with the current user and thread.

Parameters:
user The UserIdentity
token The runAsToken to associate.
Returns:
The previous runAsToken or null.
    Object setRunAs(UserIdentity userRunAsToken token);
    
    /* ------------------------------------------------------------ */
    
Disassociate the current runAsToken from the thread and reassociate the previous token.

Parameters:
token RUNAS returned from previous associateRunAs call
    void unsetRunAs(Object token);
    /* ------------------------------------------------------------ */
    
Create a new UserIdentity for use with this identity service. The UserIdentity should be immutable and able to be cached.

Parameters:
subject Subject to include in UserIdentity
userPrincipal Principal to include in UserIdentity. This will be returned from getUserPrincipal calls
roles set of roles to include in UserIdentity.
Returns:
A new immutable UserIdententity
    UserIdentity newUserIdentity(Subject subjectPrincipal userPrincipalString[] roles);
    /* ------------------------------------------------------------ */
    
Create a new RunAsToken from a runAsName (normally a role).

Parameters:
runAsName Normally a role name
Returns:
A new immutable RunAsToken
    RunAsToken newRunAsToken(String runAsName);
    /* ------------------------------------------------------------ */
New to GrepCode? Check out our FAQ X