Package com.sun.enterprise.security.common

Examples of com.sun.enterprise.security.common.ClientSecurityContext


    public static Subject getClientSubject() {

  Subject s = null;

        if ((SecurityServicesUtil.getInstance() == null) || SecurityServicesUtil.getInstance().isACC()) {
            ClientSecurityContext sc = ClientSecurityContext.getCurrent();
            if (sc != null) {
                s = sc.getSubject();
            }
            if (s == null) {
                s = Subject.getSubject(AccessController.getContext());
            }
        } else {
            SecurityContext sc = SecurityContext.getCurrent();
            if (sc != null && !sc.didServerGenerateCredentials()) {
                // make sure we don't use default unauthenticated subject,
                // so that module cannot change this important (constant)
                // subject.
                s = sc.getSubject();
            }
        }

  if (s == null) {
      s = new Subject();
View Full Code Here


     * @param Subject is the subject representation of the user
     * @param Credentials the credentials that the server associated with it
     */
    private static void setClientSecurityContext(String username,
                                                 Subject subject) {                                      
        ClientSecurityContext securityContext =
            new ClientSecurityContext(username, subject);
        ClientSecurityContext.setCurrent(securityContext);
    }
View Full Code Here

            Subject s = null;
            //if(ci == null) {
            if (isNotServerOrACC()) {
    // Standalone client ... Changed the security context
    // from which to fetch the subject
                ClientSecurityContext sc =
                    ClientSecurityContext.getCurrent();
                if(sc == null) {
                    return null;
                }
                s = sc.getSubject();
                if (_logger.isLoggable(Level.FINE)) {
                    _logger.log(Level.FINE, "SUBJECT:" + s);
                }
            } else {
                //Object obj = ci.getContainerContext();
                //if(obj instanceof AppContainer) {
                 if (isACC()) {
        // get the subject
                    ClientSecurityContext sc =
                        ClientSecurityContext.getCurrent();
                    if(sc == null) {
      s = LoginContextDriver.doClientLogin(
                                SecurityConstants.USERNAME_PASSWORD,
                                SecurityServicesUtil.getInstance().getCallbackHandler());
                    } else {
                        s = sc.getSubject();
                    }
                } else {
                    // web/ejb
                    s = getSubjectFromSecurityCurrent();
                    // TODO check if username/password is available
View Full Code Here

            Subject s = null;
            //if(ci == null) {
            if (isNotServerOrACC()) {
    // Standalone client ... Changed the security context
    // from which to fetch the subject
                ClientSecurityContext sc =
                    ClientSecurityContext.getCurrent();
                if(sc == null) {
                    return null;
                }
                s = sc.getSubject();
                if (_logger.isLoggable(Level.FINE)) {
                    _logger.log(Level.FINE, "SUBJECT:" + s);
                }
            } else {
                //Object obj = ci.getContainerContext();
                //if(obj instanceof AppContainer) {
                 if (isACC()) {
        // get the subject
                    ClientSecurityContext sc =
                        ClientSecurityContext.getCurrent();
                    if(sc == null) {
      s = LoginContextDriver.doClientLogin(
                                SecurityConstants.USERNAME_PASSWORD,
                                SecurityServicesUtil.getInstance().getCallbackHandler());
                    } else {
                        s = sc.getSubject();
                    }
                } else {
                    // web/ejb
                    s = getSubjectFromSecurityCurrent();
                    // TODO check if username/password is available
View Full Code Here

                //}
                //Object containerContext = ci.getContainerContext();
                //if(containerContext != null &&
                //(containerContext instanceof AppContainer)) {
                   if (Util.getInstance().isACC()) {
                    ClientSecurityContext ctx = ClientSecurityContext.getCurrent();
                    Subject s = ctx.getSubject();
                    if (s == null) {
                        // pass the handler and do the login
                        //TODO V3: LoginContextDriver.doClientLogin(AppContainer.CERTIFICATE,
                        //AppContainer.getCallbackHandler());
                        doClientLogin(SecurityConstants.CERTIFICATE,
                                Util.getInstance().getCallbackHandler());
                        s = ctx.getSubject();
                    }
                    Iterator itr = s.getPrivateCredentials().iterator();
                    while(itr.hasNext()) {
                        Object o = itr.next();
                        if(o instanceof X509CertificateCredential) {
View Full Code Here

     * @param Credentials the credentials that the server associated with it
     */
    private static void setClientSecurityContext(String username,
                                                 Subject subject) {
                                                
        ClientSecurityContext securityContext =
            new ClientSecurityContext(username, subject);
        ClientSecurityContext.setCurrent(securityContext);
    }
View Full Code Here

            _logger.fine("scheme=" + scheme);
            _logger.fine("requesting prompt=" + getRequestingPrompt());
            _logger.fine("requesting protocol=" + getRequestingProtocol());
        }

  ClientSecurityContext cont = ClientSecurityContext.getCurrent();
  subject = (cont != null) ? cont.getSubject() : null;
  user = getUserName(subject);
  password = getPassword(subject);
  if(user == null || password == null) {
      try {
                if (_logger.isLoggable(Level.FINE)) {
                    _logger.fine("Initiating login again...");
                }
               
    securityInfo.doClientLogin(
                loginType);
    cont = ClientSecurityContext.getCurrent();
    subject = cont.getSubject();
    user = getUserName(subject);
    password = getPassword(subject);
      } catch(Exception e) {
                _logger.log(Level.FINE, "Exception " + e.toString(), e);
          return null;
View Full Code Here

     * @param Subject is the subject representation of the user
     * @param Credentials the credentials that the server associated with it
     */
    private static void setClientSecurityContext(String username,
                                                 Subject subject) {                                      
        ClientSecurityContext securityContext =
            new ClientSecurityContext(username, subject);
        ClientSecurityContext.setCurrent(securityContext);
    }
View Full Code Here

            Subject s = null;
            //if(ci == null) {
            if (isNotServerOrACC()) {
    // Standalone client ... Changed the security context
    // from which to fetch the subject
                ClientSecurityContext sc =
                    ClientSecurityContext.getCurrent();
                if(sc == null) {
                    return null;
                }
                s = sc.getSubject();
                if (_logger.isLoggable(Level.FINE)) {
                    _logger.log(Level.FINE, "SUBJECT:" + s);
                }
            } else {
                //Object obj = ci.getContainerContext();
                //if(obj instanceof AppContainer) {
                 if (isACC()) {
        // get the subject
                    ClientSecurityContext sc =
                        ClientSecurityContext.getCurrent();
                    if(sc == null) {
      s = LoginContextDriver.doClientLogin(
                                SecurityConstants.USERNAME_PASSWORD,
                                SecurityServicesUtil.getInstance().getCallbackHandler());
                    } else {
                        s = sc.getSubject();
                    }
                } else {
                    // web/ejb
                    s = getSubjectFromSecurityCurrent();
                    // TODO check if username/password is available
View Full Code Here

     * @param Subject is the subject representation of the user
     * @param Credentials the credentials that the server associated with it
     */
    private static void setClientSecurityContext(String username,
                                                 Subject subject) {                                      
        ClientSecurityContext securityContext =
            new ClientSecurityContext(username, subject);
        ClientSecurityContext.setCurrent(securityContext);
    }
View Full Code Here

TOP

Related Classes of com.sun.enterprise.security.common.ClientSecurityContext

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.