Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/*
* JBoss, Home of Professional Open Source
* Copyright 2005, JBoss Inc., and individual contributors as indicated
* by the @authors tag. See the copyright.txt in the distribution for a
* full listing of individual contributors.
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This software 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.jboss.security.plugins.auth;
import java.lang.reflect.Method;
import java.security.AccessController;
import java.security.Principal;
import java.security.PrivilegedAction;
import java.security.PrivilegedActionException;
import java.security.PrivilegedExceptionAction;
import java.util.Iterator;
import java.util.Set;
import javax.security.auth.Subject;
import javax.security.auth.callback.CallbackHandler;
import javax.security.auth.login.LoginContext;
import javax.security.auth.login.LoginException;
import javax.security.jacc.PolicyContext;
import javax.security.jacc.PolicyContextException;
import org.jboss.security.SecurityConstants;
import org.jboss.security.SecurityContext;
import org.jboss.security.SecurityContextAssociation;
import org.jboss.security.SecurityContextFactory;
/** Common PrivilegedAction used by classes in this package.
*
* @author [email protected]
* @author [email protected]
* @version $Revision: 65313 $
*/
class SubjectActions
{
private static class ToStringSubjectAction implements PrivilegedAction
{
Subject subject;
ToStringSubjectAction(Subject subject)
{
this.subject = subject;
}
public String run()
{
StringBuffer tmp = new StringBuffer();
tmp.append("Subject(");
tmp.append(System.identityHashCode(subject));
tmp.append(").principals=");
Iterator principals = subject.getPrincipals().iterator();
while( principals.hasNext() )
{
Object p = principals.next();
Class> c = p.getClass();
tmp.append(c.getName());
tmp.append('@');
tmp.append(System.identityHashCode(c));
tmp.append('(');
tmp.append(p);
tmp.append(')');
}
return tmp.toString();
}
}
private static class GetSubjectAction implements PrivilegedExceptionAction
{
static PrivilegedExceptionAction ACTION = new GetSubjectAction();
public Subject run() throws PolicyContextException
{
return (Subject) PolicyContext.getContext(SecurityConstants.SUBJECT_CONTEXT_KEY);
}
}
private static class CopySubjectAction implements PrivilegedAction