Package com.alu.e3.common.camel

Examples of com.alu.e3.common.camel.AuthReport


          LOG.debug("Getting Policy:", policyId);
        }

        com.alu.e3.data.model.Policy policyDataModel = dataManager.getPolicyById(policyId);
        if(policyDataModel == null)
          throw new InvalidIDException("A Policy with that ID does not exist");

        Policy policy = BeanConverterUtil.fromDataModel(policyDataModel);

        PolicyResponse response = new PolicyResponse(PolicyResponse.SUCCESS);
        response.setPolicy(policy);
View Full Code Here


*/
public class PropertyExtractionProcessor implements Processor {

  @Override
  public void process(Exchange exchange) throws Exception {
    AuthIdentity identity = (AuthIdentity) exchange.getProperty(ExchangeConstantKeys.E3_AUTH_IDENTITY.toString());
    Map<String, String> props = resolveProperties(identity);

    exchange.setProperty(ExchangeConstantKeys.E3_MODEL_PROPERTIES.toString(), props);
  }
View Full Code Here

  @Override
  public void process(Exchange exchange) throws Exception {

    // Get current AuthIdentity
    AuthIdentity authIdentity = exchange.getProperty( ExchangeConstantKeys.E3_AUTH_IDENTITY.toString(), AuthIdentity.class);

    // extracts subscriber id and checks authorization
    String subscriberId = extractSubscriberId(exchange);
    if (null == subscriberId) return ;
View Full Code Here

public class SubscriberIDGenerator implements Processor {
 
  @Override
  public void process(Exchange exchange) throws Exception {

    AuthIdentity authIdentity = exchange.getProperty(ExchangeConstantKeys.E3_AUTH_IDENTITY.toString(), AuthIdentity.class);
   
    String subscriberId = null;
   
    //TODO: Check if It's what we need as subscriberID
    if (authIdentity == null || authIdentity.getAuth() == null || authIdentity.getApi() == null)
      subscriberId = UUID.randomUUID().toString();
    else
      // Align subscriberId format with SubscriberIdExtractor processor!
      subscriberId = new StringBuilder(authIdentity.getApi().getId()).append("|").append(authIdentity.getAuth().getId()).toString();
   
    exchange.getIn().setHeader(E3Constant.SUBSCRIBER_ID_HEADER_NAME, subscriberId);
  }
View Full Code Here

  }
  
  @Override
  public AuthReport checkAllowed(Api api, String authKey) {
   
    AuthReport authReport = new AuthReport();
   
    if(expectedAuthKey != null) {
   
      if(expectedAuthKey.equals(authKey)) {
       
        AuthIdentity authIdentity = new AuthIdentity();
        authIdentity.setAppId("1234");
        authReport.setAuthIdentity(authIdentity);
        authReport.setApiActive(true);
       
      } else {
        authReport.setNotAuthorized(true);
      }
     
    } else {
      authReport.setBadRequest(true);
    }
   
    return authReport;
  }
View Full Code Here

  }

  @Override
  public AuthReport checkAllowed(Api api, CanonicalizedIpAddress ip) {
   
    AuthReport authReport = new AuthReport();
 
    if(expectedIp != null) {
      if(expectedIp.equals(ip.getIp())) {
        AuthIdentity authIdentity = new AuthIdentity();
        authIdentity.setAppId("127.0.0.1");
        authReport.setAuthIdentity(authIdentity);
        authReport.setApiActive(true);
      } else {
        authReport.setNotAuthorized(true);
      }     
    } else {
      authReport.setBadRequest(true);
    }
   
   
    return authReport;
  }
View Full Code Here

  }
 
  @Override
  public AuthReport checkAllowed(Api api, String user, String password) {
   
    AuthReport authReport = new AuthReport();
   
    if(expectedUserPass != null) {
     
      if(expectedUserPass.equals(user+":"+password)) {
        AuthIdentity authIdentity = new AuthIdentity();
        authIdentity.setAppId("2424");
        authReport.setAuthIdentity(authIdentity);
        authReport.setApiActive(true);
      } else {
        authReport.setNotAuthorized(true);
      }     
    } else {
      authReport.setBadRequest(true);
    }
   
    return authReport;
  }
View Full Code Here

  }

  @Override
  public AuthReport checkAllowed(Api api) {
   
    AuthReport authReport = new AuthReport();

    AuthIdentity authIdentity = new AuthIdentity();
    authIdentity.setAppId("3424");
    authReport.setAuthIdentity(authIdentity);
    authReport.setApiActive(true);
       
    return authReport;
  }
View Full Code Here

    api.setId("api3234");

    MockAuthDataAccess mockDA = new MockAuthDataAccess(null, null, null);
    NoAuthExecutor executor = new NoAuthExecutor(mockDA);
   
    AuthReport authReport = executor.checkAllowed(exchange, api);
   
    assertNotNull("This authentication should have succeeded", authReport.getAuthIdentity());
  }
View Full Code Here

public class MockNoAuthExecutor implements IAuthExecutor {

  @Override
  public AuthReport checkAllowed(Exchange exchange, Api api) {
 
    AuthReport authReport = new AuthReport();
   
    AuthIdentity authIdentity = new AuthIdentity();
    authIdentity.setAppId("1234");
   
    authReport.setAuthIdentity(authIdentity);
    authReport.setApiActive(true);
    authReport.setAuthActive(true);
   
    return authReport; 
  }
View Full Code Here

TOP

Related Classes of com.alu.e3.common.camel.AuthReport

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.