Examples of AuthReport


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

  }
  
  @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

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

  }

  @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

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

  }
 
  @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

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

  }

  @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

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

    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

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

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

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

public class MockAppKeyExecutor implements IAuthExecutor {

  @Override
  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);
    }
   
    //return exchange.getIn().getHeaders().size() > 0 ? new AuthIdentity("1234") : null;
   
    return authReport;
View Full Code Here

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

    // This one should be denied because the MockData is rigged to return null
    exchange.getIn().setHeader(AuthHttpHeaders.Authorization.toString(), "Basic "+new String(Base64.encodeBase64("win:blarg".getBytes())));
    HttpBasicExecutor executor = new HttpBasicExecutor(new MockAuthDataAccess(null, null, null));
   
    AuthReport authReport = executor.checkAllowed(exchange, api);
   
    assertNull("This authentication should have failed", authReport.getAuthIdentity());
  }
View Full Code Here

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

public class MockHttpBasicExecutor implements IAuthExecutor {

  @Override
  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);
    }
   
    //return exchange.getIn().getHeader(AuthHeaders.AuthHttpHeaders.key)==null?null:new AppIdentity("1234");
   
    return authReport;   
View Full Code Here

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

  }
 
  @Override
  public AuthReport checkAllowed(Api api) {
   
    AuthReport authReport = new AuthReport();
   
    if(api != null) {   

      // check if the API is active (status)
      authReport.setApiActive((api.getStatus().isActive()));
      // For noAuth, Auth is always active
      authReport.setAuthActive(true);
     
      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");
          }
          authReport.setNotAuthorized(true);
        }
      }
     
    } else {
      if(logger.isDebugEnabled()) {
        logger.debug("No api found " + api.getId());
      }
      authReport.setApiNotFound(true);
    }
   
   
    return authReport;
 
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.