Package java.security

Examples of java.security.Principal


         if (opName.equals("invoke"))
         {
            Object[] args = invocation.getArgs();
            org.jboss.invocation.Invocation inv = (org.jboss.invocation.Invocation) args[0];
            // Authenticate the caller based on the security association
            Principal caller = inv.getPrincipal();
            //Get the Method Name
            Object[] obj = inv.getArguments();
            //Ignore calls like MBeanCount or getMBeanInfo
            if(obj != null && obj.length > 1)
            {
View Full Code Here


   {
      if(this.securityManagement == null)
         throw new IllegalStateException("SecurityManagement has not been injected");
      Subject subject = new Subject();
      //Validate the caller
      Principal principal = SecurityActions.getPrincipal();
      AuthenticationManager authenticationManager = securityManagement.getAuthenticationManager(securityDomainName);
      if(authenticationManager == null)
      {
         String defaultSecurityDomain = SecurityConstants.DEFAULT_APPLICATION_POLICY;
         if(log.isTraceEnabled())
View Full Code Here

      // get a reference to the remote protected stateless session bean.
      Object obj = getInitialContext().lookup("SimpleStatelessSessionBean/remote");
      SimpleSession session = (SimpleSession) PortableRemoteObject.narrow(obj, SimpleSession.class);

      Principal principal = null;
      try
      {
         principal = session.invokeRegularMethod();
         if (!(principal instanceof EJB3CustomPrincipalImpl))
            fail("Custom principal is not the caller principal");
View Full Code Here

      subject = lc.getSubject();
      Iterator iter = subject.getPrincipals().iterator();
      boolean ranAsserts = false;
      while(iter.hasNext())
      {
         Principal p = (Principal)iter.next();
         if(p instanceof SimpleGroup)
         {
            SimpleGroup sg = (SimpleGroup)p;
            ranAsserts = true;
            assertTrue("testRole exists?", sg.isMember(new SimplePrincipal("testRole")));
View Full Code Here

         Subject subject = getSubjectAndSecurityDomain();
         if(trace)
            log.trace("securityDomain="+ securityDomain);
         if(securityDomain == null)
            log.debug("Unable to obtain SecurityDomain");
         Principal principal = getPrincipal(subject);
         if(principal == null)
         {
            if(trace)
               log.trace("Searching for principal in the session");
            principal = (Principal) httpSessionEvent.getSession().getAttribute(JBOSS_PRINCIPAL);
View Full Code Here

    * @param subject
    * @return the authenticated principal
    */
   private Principal getPrincipal(Subject subject)
   {
      Principal principal = null;
      if(subject != null)
      {
         Set principals = subject.getPrincipals();
         if(principals != null || !principals.isEmpty())
         {
View Full Code Here

   /**
    * @return the name of the Principal
    */
   public String getAsText()
   {
      Principal principal = (Principal) getValue();
      return principal.getName();
   }
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

         Subject serviceSubject) throws AuthException
   {
      Request request = (Request) messageInfo.getRequestMessage();
      Response response = (Response) messageInfo.getResponseMessage();
    
      Principal principal;
      context = request.getContext();
      LoginConfig config = context.getLoginConfig();
      
      // References to objects we will need later
      Session session = null;
View Full Code Here

   {
      //References to objects we will need later
      Session session = null;

      // Have we already authenticated someone?
      Principal principal = request.getUserPrincipal();
      String ssoId = (String) request.getNote(Constants.REQ_SSOID_NOTE);
      if (principal != null) {
          if (log.isDebugEnabled())
              log.debug("Already authenticated '" +
                  principal.getName() + "'");
          // Associate the session with any existing SSO session
          if (ssoId != null)
              associate(ssoId, request.getSessionInternal(true));
          return (true);
      }
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.