Examples of PrimaryPrincipal


Examples of org.apache.geronimo.security.PrimaryPrincipal

        Principal domainPrincipal = ConfigurationUtil.generatePrincipal(className, principalName, classLoader);
        if (domainPrincipal == null) {
            throw new GeronimoSecurityException("Unable to create principal");
        }
        PrimaryPrincipal primaryDomainPrincipal = null;
        try {
            primaryDomainPrincipal = ConfigurationUtil.generatePrimaryPrincipal(className, principalName, classLoader);
        } catch (DeploymentException e) {
            throw new GeronimoSecurityException("Unable to create primary principal", e);
        }
View Full Code Here

Examples of org.apache.geronimo.security.PrimaryPrincipal

                    java.security.Principal p = null;
                    Class clazz = classLoader.loadClass(className);
                    Constructor constructor = clazz.getDeclaredConstructor(new Class[]{String.class});
                    p = (java.security.Principal) constructor.newInstance(new Object[]{principalName});

                    return new PrimaryPrincipal(p);
                }
            });
        } catch (PrivilegedActionException pae) {
            throw new DeploymentException("Unable to create principal", pae.getException());
        }
View Full Code Here

Examples of org.apache.geronimo.security.PrimaryPrincipal

                    Principal p = null;
                    Class clazz = classLoader.loadClass(className);
                    Constructor constructor = clazz.getDeclaredConstructor(new Class[]{String.class});
                    p = (Principal) constructor.newInstance(new Object[]{principalName});

                    return new PrimaryPrincipal(p);
                }
            });
        } catch (PrivilegedActionException pae) {
            throw new DeploymentException("Unable to create principal", pae.getException());
        }
View Full Code Here

Examples of org.apache.geronimo.security.PrimaryPrincipal

                    java.security.Principal p = null;
                    Class clazz = classLoader.loadClass(className);
                    Constructor constructor = clazz.getDeclaredConstructor(new Class[]{String.class});
                    p = (java.security.Principal) constructor.newInstance(new Object[]{principalName});

                    return new PrimaryPrincipal(p);
                }
            });
        } catch (PrivilegedActionException pae) {
            throw new DeploymentException("Unable to create principal", pae.getException());
        }
View Full Code Here

Examples of org.apache.hadoop.gateway.security.PrimaryPrincipal

  public void testResolve() throws Exception {
    final UsernameFunctionProcessor processor = new UsernameFunctionProcessor();
    assertThat( processor.resolve( null, null ), nullValue() );
    assertThat( processor.resolve( null, Arrays.asList( "test-input" ) ), contains( "test-input" ) );
    Subject subject = new Subject();
    subject.getPrincipals().add( new PrimaryPrincipal( "test-username" ) );
    subject.setReadOnly();
    Subject.doAs( subject, new PrivilegedExceptionAction<Object>() {
      @Override
      public Object run() throws Exception {
        assertThat( processor.resolve( null, null ), contains( "test-username" ) );
View Full Code Here

Examples of org.apache.hadoop.gateway.security.PrimaryPrincipal

    else {
      // something is amiss - authentication/federation providers should have run
      // before identity assertion and should have ensured that the appropriate
      // principals were added to the current subject
      // TODO: log as appropriate
      primaryPrincipal = new PrimaryPrincipal(((HttpServletRequest) request).getUserPrincipal().getName());
    }
   
    groupsMapped = areGroupsMappedForPrincipal(mappedPrincipalName) || !currentGroups.isEmpty();
   
    if (impersonationNeeded || groupsMapped) {
View Full Code Here

Examples of org.apache.hadoop.gateway.security.PrimaryPrincipal

    HttpServletRequest httpRequest = (HttpServletRequest)request;
    String principal = getPrimaryPrincipal(httpRequest);
    if (principal != null) {
      if (isValid(httpRequest)) {
        Subject subject = new Subject();
        subject.getPrincipals().add(new PrimaryPrincipal(principal));
        addGroupPrincipals(httpRequest, subject.getPrincipals());
        doAs(httpRequest, response, chain, subject);
      }
      else {
        // TODO: log preauthenticated SSO validation failure
View Full Code Here

Examples of org.apache.hadoop.gateway.security.PrimaryPrincipal

  private Subject createSubjectFromToken(JWTToken token) {
    final String principal = token.getPrincipal();

    HashSet emptySet = new HashSet();
    Set<Principal> principals = new HashSet<Principal>();
    Principal p = new PrimaryPrincipal(principal);
    principals.add(p);
   
//        The newly constructed Sets check whether this Subject has been set read-only
//        before permitting subsequent modifications. The newly created Sets also prevent
//        illegal modifications by ensuring that callers have sufficient permissions.
View Full Code Here

Examples of org.apache.hadoop.gateway.security.PrimaryPrincipal

      };
      Subject shiroSubject = SecurityUtils.getSubject();
      final String principal = (String) shiroSubject.getPrincipal();
      HashSet emptySet = new HashSet();
      Set<Principal> principals = new HashSet<Principal>();
      Principal p = new PrimaryPrincipal(principal);
      principals.add(p);
      auditService.createContext().setUsername( principal );
      String sourceUri = (String)request.getAttribute( AbstractGatewayFilter.SOURCE_REQUEST_CONTEXT_URL_ATTRIBUTE_NAME );
      auditor.audit( Action.AUTHENTICATION , sourceUri, ResourceType.URI, ActionOutcome.SUCCESS );
     
View Full Code Here

Examples of org.apache.hadoop.gateway.security.PrimaryPrincipal

      throws IOException, ServletException {
    HttpServletRequest httpRequest = (HttpServletRequest)request;
    String principal = httpRequest.getRemoteUser();
    if (principal != null) {
        Subject subject = new Subject();
        subject.getPrincipals().add(new PrimaryPrincipal(principal));
        log.hadoopAuthAssertedPrincipal(principal);
        doAs(httpRequest, response, chain, subject);
    }
    else {
      ((HttpServletResponse)response).sendError(HttpServletResponse.SC_FORBIDDEN, "User not authenticated");
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.