Examples of AuthIdentity


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

  @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);
   
View Full Code Here

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

  public AuthReport checkAllowed(Exchange exchange, Api api) {
   
    AuthReport authReport = new AuthReport();
   
    if(exchange.getIn().getHeaders().size() > 0) {
      AuthIdentity authIdentity = new AuthIdentity();
      authIdentity.setAppId("1234");
      authReport.setAuthIdentity(authIdentity);
      authReport.setApiActive(true);
      authReport.setAuthActive(true);
    } else {
      authReport.setBadRequest(true);
View Full Code Here

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

public class TestHelper {

  public static Exchange setupExchange(){
    Exchange exchange = new MockExchange();

    AuthIdentity id = new AuthIdentity();
    Api api = new Api();
    Policy policy1 = new Policy();
    Auth auth = new Auth();
    CallDescriptor cd = new CallDescriptor(policy1, 0, 0);

    id.setApi(api);
    id.setAuth(auth);
    id.getCallDescriptors().add(cd);

    exchange.setProperty(ExchangeConstantKeys.E3_AUTH_IDENTITY.toString(), id);

    return exchange;
  }
View Full Code Here

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

  public AuthReport checkAllowed(Exchange exchange, Api api) {
   
    AuthReport authReport = new AuthReport();
   
    if(exchange.getIn().getHeader(AuthHttpHeaders.Authorization.toString()) != null) {
      AuthIdentity authIdentity = new AuthIdentity();
      authIdentity.setAppId("1234");
      authReport.setAuthIdentity(authIdentity);
      authReport.setApiActive(true);
      authReport.setAuthActive(true);
    }
   
View Full Code Here

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

    if (property == null || ! (property instanceof AuthIdentity)) {
      throw new GatewayException(GatewayExceptionCode.RATEORQUOTA, "The property " + ExchangeConstantKeys.E3_AUTH_IDENTITY.toString() + " is required to check the rate limits.");
    }

    boolean isTDREnabled = exchange.getProperty(ExchangeConstantKeys.E3_TDR_ENABLED.toString(), boolean.class);
    AuthIdentity authIdentity = (AuthIdentity) property;
    LimitCheckResult limitCheckResult = rateManager.isAllowed(authIdentity, isTDREnabled);

    if(isTDREnabled){
      /**
       * Put some TDR data into into service
View Full Code Here

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

      if(authReport.isApiActive()) {

        List<CallDescriptor> descriptors = this.dataManager.getMatchingPolicies(api);
       
        if(descriptors != null) {
          authReport.setAuthIdentity(new AuthIdentity());
          authReport.getAuthIdentity().setApi(api);
          authReport.getAuthIdentity().getCallDescriptors().addAll(descriptors);         
        } else {
          if(logger.isDebugEnabled()) {
            logger.debug("NoAuth method is not enabled");
View Full Code Here

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

                break;
              }
            }
           
            if (foundPolicy) {
              authReport.setAuthIdentity(new AuthIdentity());
              authReport.getAuthIdentity().setApi(api);
              authReport.getAuthIdentity().setAuth(auth);
              authReport.getAuthIdentity().getCallDescriptors().addAll(descriptors);
            } else {
              if(logger.isDebugEnabled()) {
View Full Code Here

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

public class AuthIdentityHelper {

  private AuthIdentity authIdentity = null;
 
  public AuthIdentityHelper() {
    this.authIdentity = new AuthIdentity();
  }
View Full Code Here

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

   * prerequisite TDR stuff.
   */
  @Before
  public void setup(){
    exchange = TestHelper.setupExchange();
    AuthIdentity id = (AuthIdentity) exchange.getProperty(ExchangeConstantKeys.E3_AUTH_IDENTITY.toString());
    auth = id.getAuth();
    api = id.getApi();
    policy1 = id.getCallDescriptors().get(0).getPolicy();

    responseProcessor = new TDRResponseProcessor();
    requestProcessor = new TDRRequestProcessor();
    staticProcessor = new TDRStaticProcessor();

View Full Code Here

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

    }

    AuthType authType = AuthType.NO_AUTH;
   
    boolean isAllowed = false;
    AuthIdentity authIdentity = null;
    AuthReport report = null;
    AuthType reportAuth = null;
   
    Iterator<IAuthExecutor> it = executors.iterator();
    while(!isAllowed && it.hasNext()) {
     
      IAuthExecutor executor = it.next();
      AuthReport authReport = executor.checkAllowed(exchange, api)
      isAllowed = authReport.isAllowed();
     
      if (isAllowed) {
        authIdentity = authReport.getAuthIdentity();
        report = authReport;
      } else {
        if (report == null) {
          report = authReport;
          reportAuth = executor.getType();
        } else {
          if (report.compareTo(authReport) > 0) {
            report = authReport;
            reportAuth = executor.getType();
          }
        }
      }
      // The last executor
      authType = executor.getType();
    }
   
    if (isAllowed) {
      if(logger.isDebugEnabled()) {
        logger.debug("Request allowed to use this Api");
      }
    } else {
      if(logger.isDebugEnabled()) {
        logger.debug("Request not allowed to use this Api");
      }
      handleReport(exchange, report, reportAuth);
    }

    // Put this in the exchange for TDRs
    TDRDataService.setTxTDRProperty(TDRConstant.AUTHENTICATION, authType.value(), exchange);
   
    // Set the authentication result in the exchange
    exchange.setProperty(ExchangeConstantKeys.E3_AUTH_METHOD.toString(), authType.value())
   
    //getting apiContext
    String value = null;
    if(authIdentity != null && authIdentity.getAuth() != null){
        value = authIdentity.getAuth().getApiContext();
    }
   
    exchange.setProperty(ExchangeConstantKeys.E3_AUTH_IDENTITY.toString(), authIdentity);
    exchange.setProperty(ExchangeConstantKeys.E3_AUTH_IDENTITY_APICONTEXT.toString(), value)
  }
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.