Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
I'm using j_security_check on a login.jsp. The server is GlassFish Server 3. It all works, when the user is authenticated it then opens index.jsp. My problem is I need to get j_username in my index.jsp, but I couldn't find a way of doing it. All solutions I found are in Java and I need something that works with my jsp. Any ideas? Thank you very much in advance!
I'm developing a webservice in Java on a stack of Metro and Tomcat, and my problem is with the user authentication. I understand Tomcat can make use of several external authentication realms, such as JDBCRealm or JNDIRealm, and I want my endusers to configure their Tomcat installation for their respective realm. Now, what I need in my webservice-methods is the user name (or id, something uniqu...
I want to store the the user's ID in a session variable to use across the application. I don't see how I'd do that with the default security feature? It authenticates itself and I don't know (if) there is a callback function or something? That we can use to do our house-keeping Any help is deeply appreciated
I have implemented UserDetailsServce, it returns an instance of MyUser (which implements UserDetails) public MyUser loadUserByUsername(String arg0) I now want to access my custom getters/fields on MyUSer in my jsp pages, so far I got this: ${pageContext.request.userPrincipal.name} But that only allows access to a Principal object, how can I access MyUser object
I'm running Glassfish 3.0 and I'm implementing JDBCRealm for login authentication. The username and roles are saved in a table called usertable. The authentication is working as expected. But the problem is now when the user logs in, how can I retrieve the username of the logged in user in the application? PS: I'm implementing JSF page and Managed Bean
 /*
  * Copyright 1996-1998 Sun Microsystems, Inc.  All Rights Reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.  Sun designates this
  * particular file as subject to the "Classpath" exception as provided
  * by Sun in the LICENSE file that accompanied this code.
 *
 * This code is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 * version 2 for more details (a copy is included in the LICENSE file that
 * accompanied this code).
 *
 * You should have received a copy of the GNU General Public License version
 * 2 along with this work; if not, write to the Free Software Foundation,
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 *
 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
 * CA 95054 USA or visit www.sun.com if you need additional information or
 * have any questions.
 */
package java.security;

This interface represents the abstract notion of a principal, which can be used to represent any entity, such as an individual, a corporation, and a login id.

Author(s):
Li Gong
See also:
java.security.cert.X509Certificate
public interface Principal {

    
Compares this principal to the specified object. Returns true if the object passed in matches the principal represented by the implementation of this interface.

Parameters:
another principal to compare with.
Returns:
true if the principal passed in is the same as that encapsulated by this principal, and false otherwise.
    public boolean equals(Object another);

    
Returns a string representation of this principal.

Returns:
a string representation of this principal.
    public String toString();

    
Returns a hashcode for this principal.

Returns:
a hashcode for this principal.
    public int hashCode();

    
Returns the name of this principal.

Returns:
the name of this principal.
    public String getName();
New to GrepCode? Check out our FAQ X