Package org.apache.hadoop.gateway.topology

Examples of org.apache.hadoop.gateway.topology.Provider


      ResourceDescriptor resource,
      String role,
      String name,
      List<FilterParamDescriptor> params ) {
    ProviderDeploymentContributor contributor = DeploymentFactory.getProviderContributor( providers, role, name );
    Provider provider = getTopology().getProvider( role, name );
//    if( provider != null ) {
//      System.out.println("=================== provider found by name: " + name + " with actual name of: " + provider.getName());
//    }
    if( provider == null ) {
      provider = new Provider();
      provider.setRole( role );
      provider.setName( name );
      provider.setEnabled( true );
    }
    if( provider.isEnabled() ) {
      contributor.contributeFilter( this, provider, service, resource, params );
    }
  }
View Full Code Here


  }

  @Test
  public void testProviderParamsOrderIsPreserved() {
   
    Provider provider = new Provider();
    String names[] = {"ldapRealm=",
        "ldapContextFactory",
        "ldapRealm.contextFactory",
        "ldapGroupRealm",
        "ldapGroupRealm.contextFactory",
        "ldapGroupRealm.contextFactory.systemAuthenticationMechanism"
    };
   
    Param param = null;
    for (String name : names) {
      param = new Param();
      param.setName(name);
      param.setValue(name);
      provider.addParam(param);
     
    }
    Map<String, String> params = provider.getParams();
    Set<String> keySet = params.keySet();
    Iterator<String> iter = keySet.iterator();
    int i = 0;
    while (iter.hasNext()) {
      assertTrue(iter.next().equals(names[i++]));
View Full Code Here

  public void finalizeContribution( DeploymentContext context ) {
    // Noop.
  }

  protected boolean topologyContainsProviderType(DeploymentContext context, String role) {
    Provider provider = getProviderByRole(context, role);
    return (provider != null);
  }
View Full Code Here

    Provider provider = getProviderByRole(context, role);
    return (provider != null);
  }
 
  protected Provider getProviderByRole(DeploymentContext context, String role) {
    Provider p = null;
    Collection<Provider> providers = context.getTopology().getProviders();
    for (Provider provider : providers) {
      if (role.equals(provider.getRole())) {
        p = provider;
        break;
View Full Code Here

    Service service = new Service();
    service.setRole( "WEBHDFS" );
    service.setUrl( "http://localhost:50070/test-service-url" );
    topology.addService( service );

    Provider provider = new Provider();
    provider.setRole( "authentication" );
    provider.setName( "generic" );
    provider.setEnabled( true );
    Param param = new Param();
    param.setName( "filter" );
    param.setValue( "org.opensource.ExistingFilter" );
    provider.addParam( param );
    param = new Param();
    param.setName( "test-param-name" );
    param.setValue( "test-param-value" );
    provider.addParam( param );
    topology.addProvider( provider );

    WebArchive war = DeploymentFactory.createDeployment( config, topology );

    Document gateway = parse( war.get( "WEB-INF/gateway.xml" ).getAsset().openStream() );
View Full Code Here

    Service service = new Service();
    service.setRole( "WEBHDFS" );
    service.setUrl( "http://localhost:50070/test-service-url" );
    topology.addService( service );

    Provider provider = new Provider();
    provider.setRole( "authentication" );
    provider.setName( "generic" );
    provider.setEnabled( true );
    Param param; // = new ProviderParam();
    // Missing filter param.
    //param.setName( "filter" );
    //param.setValue( "org.opensource.ExistingFilter" );
    //provider.addParam( param );
    param = new Param();
    param.setName( "test-param-name" );
    param.setValue( "test-param-value" );
    provider.addParam( param );
    topology.addProvider( provider );

    Enumeration<Appender> appenders = NoOpAppender.setUp();
    try {
      DeploymentFactory.createDeployment( config, topology );
View Full Code Here

    topology.setName( "test-cluster" );
    Service service = new Service();
    service.setRole( "WEBHDFS" );
    service.setUrl( "http://localhost:50070/webhdfs" );
    topology.addService( service );
    Provider provider = new Provider();
    provider.setRole( "authentication" );
    provider.setEnabled( true );
    Param param = new Param();
    param.setName( "contextConfigLocation" );
    param.setValue( "classpath:app-context-security.xml" );
    provider.addParam( param );
    topology.addProvider( provider );
    Provider asserter = new Provider();
    asserter.setRole( "identity-assertion" );
    asserter.setName("Pseudo");
    asserter.setEnabled( true );
    topology.addProvider( asserter );
    Provider authorizer = new Provider();
    authorizer.setRole( "authorization" );
    authorizer.setName("AclsAuthz");
    authorizer.setEnabled( true );
    topology.addProvider( authorizer );

    WebArchive war = DeploymentFactory.createDeployment( config, topology );
    //File dir = new File( System.getProperty( "user.dir" ) );
    //File file = war.as( ExplodedExporter.class ).exportExploded( dir, "test-cluster.war" );
View Full Code Here

    WebArchive webArchive = ShrinkWrap.create( WebArchive.class, "test-archive" );

    Topology topology = new Topology();
    topology.setName( "test-topology" );
    Provider provider = new Provider();
    provider.setRole( "pivot" );
    provider.setName( "jersey" );
    provider.setEnabled( true );
    topology.addProvider( provider );

    GatewayDescriptor descriptor = GatewayDescriptorFactory.create();

    DeploymentContext context = EasyMock.createNiceMock( DeploymentContext.class );
View Full Code Here

  @Test
  public void testDeployment() throws IOException {
    WebArchive webArchive = ShrinkWrap.create( WebArchive.class, "test-archive" );

    Map<String,String> providerParams = new HashMap<String, String>();
    Provider provider = new Provider();
    provider.setEnabled( true );
    provider.setName( "shiro" );
    provider.setParamsproviderParams );

    Topology topology = new Topology();
    topology.setName( "Sample" );

    DeploymentContext context = EasyMock.createNiceMock( DeploymentContext.class );
View Full Code Here

  @Override
  public void contributeFilter(DeploymentContext context, Provider provider, Service service,
      ResourceDescriptor resource, List<FilterParamDescriptor> params) {
   
    Provider webappsec = context.getTopology().getProvider(ROLE, NAME);
    if (webappsec != null && webappsec.isEnabled()) {
      Map<String,String> map = provider.getParams();
      String csrfEnabled = map.get(CSRF_ENABLED);
      if ( csrfEnabled != null && csrfEnabled.equals("true")) {
        resource.addFilter().name( getName() + CSRF_SUFFIX ).role( getRole() ).impl( CSRF_FILTER_CLASSNAME ).params( params );
      }
View Full Code Here

TOP

Related Classes of org.apache.hadoop.gateway.topology.Provider

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.