Package java.security

Examples of java.security.Principal


   2. Validate access to the method by checking the principal's roles against
   those required to access the method.
   */
   private void checkSecurityContext(Invocation mi, RunAs callerRunAsIdentity) throws Exception
   {
      Principal principal = mi.getPrincipal();
      Object credential = mi.getCredential();

      boolean trace = log.isTraceEnabled();

      // If there is not a security manager then there is no authentication required
View Full Code Here


      if (LOG.isTraceEnabled())
          LOG.trace(" Checking for cached principal for " + ssoId);
      JBossSingleSignOnEntry entry = getSingleSignOnEntry(cookie.getValue());
      if (entry != null && isValid(ssoId, entry))
      {
         Principal ssoPrinc = entry.getPrincipal();
         // have to deal with the fact that the entry may not have an
         // associated Principal. SSO entries retrieved via a lookup from a
         // cluster will not have a Principal, as Principal is not Serializable
         if (LOG.isTraceEnabled())
         {
             LOG.trace(" Found cached principal '" +
               (ssoPrinc == null ? "NULL" : ssoPrinc.getName()) +
               "' with auth type '" + entry.getAuthType() + "'");
         }
         request.setNote(Constants.REQ_SSOID_NOTE, cookie.getValue());
         // Only set security elements if per-request reauthentication is
         // not required AND the SSO entry had a Principal. 
View Full Code Here

      {

         String username = entry.getUsername();
         if (username != null)
         {
            Principal reauthPrincipal =
               realm.authenticate(username, entry.getPassword());
            if (reauthPrincipal != null)
            {
               reauthenticated = true;                   
               // Bind the authorization credentials to the request
View Full Code Here

                   " to auth type " + credentials.getAuthType());

         synchronized (sso)
         {
            // Use the existing principal
            Principal p = sso.getPrincipal();
            sso.updateCredentials(p, credentials.getAuthType(),
                                  credentials.getUsername(),
                                  credentials.getPassword());
         }
      }
View Full Code Here

      {
         // Get the principal username
         String username;
         if( principal instanceof Principal )
         {
            Principal p = (Principal) principal;
            username = p.getName();
         }
         else
         {
            username = principal.toString();
         }
View Full Code Here

   {
      return AccessController.doPrivileged(new PrivilegedAction<Principal>()
      {
         public Principal run()
         {
            Principal principal = null;
            SecurityContext sc = getSecurityContext();
            if(sc != null)
            {
               principal = sc.getUtil().getUserPrincipal();
            }
View Full Code Here

      throws NamingException
   {
      // Get the login principal and credentials from the JNDI env
      Object credentials = env.get(Context.SECURITY_CREDENTIALS);
      Object principal = env.get(Context.SECURITY_PRINCIPAL);
      Principal securityPrincipal = null;
      /** Flag indicating if the SecurityAssociation existing at login should
      be restored on logout.
      */
      String flag = (String) env.get("jnp.multi-threaded");
      if (Boolean.valueOf(flag).booleanValue() == true)
View Full Code Here

      return isValid;
   }

   public Principal getPrincipal(String securityDomain, Principal principal)
   {
      Principal realmPrincipal = null;
      try
      {
         SecurityDomainContext sdc = lookupSecurityDomain(securityDomain);
         realmPrincipal = sdc.getRealmMapping().getPrincipal(principal);
      }
View Full Code Here

   {

      /* this gets called by the interceptor */

      Transaction tx = mi.getTransaction();
      Principal princ = mi.getPrincipal();
      Method method = mi.getMethod();
      Entry start = new Entry(princ, method, tx, begin, "START");
      Entry stop = new Entry(princ, method, tx, end, "STOP");

      // add both entries, order is guaranteed, synchronized to prevent
View Full Code Here

    *
    * @param principal The new Principal, or <code>null</code> if none
    */
   public void setPrincipal(Principal principal)
   {
      Principal oldPrincipal = this.principal;
      this.principal = principal;
      support.firePropertyChange("principal", oldPrincipal, this.principal);

      if ((oldPrincipal != null && !oldPrincipal.equals(principal)) ||
         (oldPrincipal == null && principal != null))
         sessionMetadataDirty();
   }
View Full Code Here

TOP

Related Classes of java.security.Principal

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.