Examples of ClientSecurityContext


Examples of com.sun.enterprise.security.ClientSecurityContext

                        excep = ex;
                        Throwable target = ex.getTargetException();
                        if (target instanceof AccessException) {
                            AccessException aexcep = (AccessException)target;
                            if (aexcep.detail instanceof NO_PERMISSION) {
                                ClientSecurityContext sc = ClientSecurityContext.getCurrent();
                                if (ClientSecurityContext.hasEmtpyCredentials(sc)) {
                                    // this is due to a cancel by the user so break out
                                    break;
                                } else {
                                    //retry the invocation after clearing the Context
View Full Code Here

Examples of com.sun.enterprise.security.ClientSecurityContext

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

Examples of com.sun.enterprise.security.ClientSecurityContext

  SOAPAuthParam param = new SOAPAuthParam(request, null);

  Subject subject = null;
  if (isAppClient) {
      ClientSecurityContext sc = ClientSecurityContext.getCurrent();
      if (sc != null) {
    subject = sc.getSubject();
      }
  } 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.
    subject = sc.getSubject();
      }
  }
  if (subject == null) subject = new Subject();
 
  cAC.secureRequest ( param, subject, sharedState);
View Full Code Here

Examples of com.sun.enterprise.security.ClientSecurityContext

  Subject s = null;

  if (Switch.getSwitch().getContainerType() ==
      Switch.APPCLIENT_CONTAINER) {

      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

Examples of com.sun.enterprise.security.ClientSecurityContext

            _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...");
                }
               
    LoginContextDriver.doClientLogin(AppContainer.USERNAME_PASSWORD,
      AppContainer.getCallbackHandler());
    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

Examples of com.sun.enterprise.security.ClientSecurityContext

     * @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

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

  SOAPAuthParam param = new SOAPAuthParam(request, null);

  Subject subject = null;
  if (isAppClient) {
      ClientSecurityContext sc = ClientSecurityContext.getCurrent();
      if (sc != null) {
    subject = sc.getSubject();
      }
  } 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.
    subject = sc.getSubject();
      }
  }
  if (subject == null) subject = new Subject();
 
  cAC.secureRequest ( param, subject, sharedState);
View Full Code Here

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

            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

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

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

  SOAPAuthParam param = new SOAPAuthParam(request, null);

  Subject subject = null;
  if (isAppClient) {
      ClientSecurityContext sc = ClientSecurityContext.getCurrent();
      if (sc != null) {
    subject = sc.getSubject();
      }
  } 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.
    subject = sc.getSubject();
      }
  }
  if (subject == null) subject = new Subject();
 
  cAC.secureRequest ( param, subject, sharedState);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.