Package java.security

Examples of java.security.Principal


      {
         Subject caller = (Subject) PolicyContext.getContext(SUBJECT_CONTEXT_KEY);
         Iterator iter = caller.getPrincipals().iterator();
         while(iter != null && iter.hasNext())
         {
            Principal p = (Principal)iter.next();
            if(p instanceof SimpleGroup)
            {
               SimpleGroup sg = (SimpleGroup)p;
               String name = sg.getName();
               if("Roles".equals(name))
View Full Code Here


   private static class GetPrincipalAction implements PrivilegedAction
   {
      static PrivilegedAction ACTION = new GetPrincipalAction();
      public Object run()
      {
         Principal principal = SecurityAssociation.getPrincipal();
         return principal;
      }
View Full Code Here

         Principal principal = SecurityAssociation.getPrincipal();
         return principal;
      }
      static Principal getPrincipal()
      {
         Principal principal = (Principal) AccessController.doPrivileged(ACTION);
         return principal;
      }
View Full Code Here

   public void doFilter(ServletRequest request, ServletResponse response,
      FilterChain chain)
      throws IOException, ServletException
   {
      HttpServletRequest httpRequest = (HttpServletRequest) request;
      Principal user = httpRequest.getUserPrincipal();
      // If there was a read-only context specified validate access
      if( user == null && readOnlyContext != null )
      {
         // Extract the invocation
         ServletInputStream sis = request.getInputStream();
View Full Code Here

      iter = requiredRoles.iterator();
      boolean hasRole = false;
      while( iter.hasNext() && hasRole == false )
      {
         Principal p = (Principal) iter.next();
         hasRole = roles.isMember(p);
      }
      if( hasRole == false )
      {
         throw new SecurityException("Authorization failure, requiredRoles="+requiredRoles
View Full Code Here

               mi.setMethodMap(marshalledInvocationMapping);
            }
            // Invoke the MBeanServer method via reflection
            Method method = invocation.getMethod();
            Object[] args = invocation.getArguments();
            Principal principal = invocation.getPrincipal();
            Object credential = invocation.getCredential();
            Object value = null;
            SecurityContext sc = SecurityActions.createSecurityContext(SecurityConstants.DEFAULT_APPLICATION_POLICY);
            SecurityActions.setSecurityContext(sc);
            // Associate the method
View Full Code Here

         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();
            Object credential = inv.getCredential();
            subject = new Subject();
            boolean isValid = securityMgr.isValid(caller, credential, subject);
            if (isValid == false)
            {
View Full Code Here

      boolean result = false;
     
      String authMethod = config.getAuthMethod();

      // Have we already authenticated someone?
      Principal principal = request.getUserPrincipal();
      String ssoId = (String) request.getNote(Constants.REQ_SSOID_NOTE);
      if (principal != null) {
         log.trace("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

      }

      // prepare security data
      final SPIProvider spiProvider = SPIProviderResolver.getInstance().getProvider();
      final SecurityAdaptor securityAdaptor = spiProvider.getSPI(SecurityAdaptorFactory.class).newSecurityAdapter();
      final Principal principal = securityAdaptor.getPrincipal();
      final Object credential = securityAdaptor.getCredential();

      // prepare invocation data
      final Method method = wsInvocation.getJavaMethod();
      final Object[] args = wsInvocation.getArgs();
View Full Code Here

   @Override
   public boolean authenticate(Request request, HttpServletResponse response, LoginConfig config) throws IOException
   {
      log.trace("Authenticating user");

      Principal principal = request.getUserPrincipal();
      if (principal != null)
      {
         if (trace)
            log.trace("Already authenticated '" + principal.getName() + "'");
         return true;
      }

      Realm realm = context.getRealm();
      Session session = request.getSessionInternal(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.