Package com.alu.e3.data.model

Examples of com.alu.e3.data.model.Auth



  protected List<CallDescriptor> checkSubscriberIdAuth(String subscriberId, AuthIdentity authIdentity) throws GatewayException {

    // Get subscriber matching CallDescriptors
    Auth auth;
    try {
      auth = dataManager.getAuthById(subscriberId);
    } catch (InvalidIDException e) {
      throw new GatewayException(GatewayExceptionCode.AUTHORIZATION, e.getMessage() );
    }

    if (auth == null || !auth.getStatus().isActive()) {
      throw new GatewayException(GatewayExceptionCode.AUTHORIZATION, "Authorization status is invalid");
    }

    return   dataManager.getMatchingPolicies(authIdentity.getApi(), auth);
View Full Code Here


          processTdrGenerationRuleDynamic(policy.getTdrGenerationRule(), exchange, properties, efType);
      }
    }

    // Finally add the values from the Auth
    Auth auth = identity.getAuth();
    if(auth != null)
      if(doStatic)
        processTdrGenerationRuleStatic(auth.getTdrGenerationRule(), exchange, properties);
      else
        processTdrGenerationRuleDynamic(auth.getTdrGenerationRule(), exchange, properties, efType);
  }
View Full Code Here

  }

  public static final Auth toDataModel(com.alu.e3.prov.restapi.model.Auth authData) {
    if (authData==null) throw new IllegalArgumentException("authData must not be null");

    Auth auth = new Auth()
    auth.setId            (authData.getId());
    auth.setStatus          (toDataModel(authData.getStatus()));
    auth.setTdrGenerationRule    (toDataModel(authData.getTdr()));
    auth.setApiContext           (authData.getApiContext());
    auth.setPolicyContext         (authData.getPolicyContext());
    auth.setHeaderTransformation    (BeanConverterUtil.<HeaderTransformation, com.alu.e3.prov.restapi.model.HeaderTransformation>toDataModels(authData.getHeaderTransformations()));

    for(Key prop : authData.getProperties()){
      auth.getProperties().put(prop.getName(), prop.getValue());
    }

    AuthDetail authDetail = new AuthDetail();
    auth.setAuthDetail        (authDetail);

    authDetail.setType        (toDataModel(authData.getType()));

    switch(authData.getType()) {
    case AUTHKEY:
      authDetail.setAuthKeyValue(authData.getAuthKeyAuth().getKeyValue());
      break;
    case BASIC:
      authDetail.setUsername(authData.getBasicAuth().getUsername());
      authDetail.setPassword(authData.getBasicAuth().getPassword());
      break;
    case IP_WHITE_LIST:
      authDetail.getWhiteListedIps().addAll(authData.getIpWhiteListAuth().getIp());
      break;
    case NO_AUTH:
      break;
    case OAUTH:
      authDetail.setClientId(authData.getOAuth().getClientId());
      authDetail.setClientSecret(authData.getOAuth().getClientSecret());
      break;
    case WSSE:
      authDetail.setUsername(authData.getWsseAuth().getUsername());
      auth.setWssePassword(authData.getWsseAuth().getPassword());
      break;
    default:
      throw new IllegalArgumentException("Unknown authType specified");
    }
View Full Code Here

 
  @Test
  @DirtiesContext
  public void testRateOK() throws Exception {
    AuthIdentity authIdentity = new AuthIdentity();
    Auth auth = new Auth();
    auth.setId("abc");
    authIdentity.setAuth(auth);

    AuthProcessorMock authProcessor =  new AuthProcessorMock(authIdentity);

    checkAuth.whenAnyExchangeReceived(authProcessor);
View Full Code Here

  @Test
  @DirtiesContext
  public void testRateKO() throws Exception {
    AuthIdentity authIdentity = new AuthIdentity();
    Auth auth = new Auth();
    auth.setId("ko");
    authIdentity.setAuth(auth);

    AuthProcessorMock authProcessor =  new AuthProcessorMock(authIdentity);

    checkAuth.whenAnyExchangeReceived(authProcessor);
View Full Code Here

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

   * Sets the Auth from an auth key
   * @param authKey
   */
  public void setAuth(String authKey) {
   
    Auth auth = new Auth();   
    auth.setAuthDetail(new AuthDetail());
    auth.getAuthDetail().setAuthKeyValue(authKey);
   
    this.authIdentity.setAuth(auth);
  }
View Full Code Here

   * @param userName
   * @param password
   */
  public void setAuth(String userName, String password) {
   
    Auth auth = new Auth();   
    auth.setAuthDetail(new AuthDetail());
    auth.getAuthDetail().setUsername(userName);
    auth.getAuthDetail().setPassword(password.getBytes())
   
    this.authIdentity.setAuth(auth);
  }
View Full Code Here

  @Override
  public AuthReport checkAllowed(Api api, String authKey) {
    if(logger.isDebugEnabled()) {
      logger.debug("Checking AuthKey [" + authKey + "] for Api [" + api.getId() + "]");
    }
    Auth auth = this.dataManager.getAuthByAuthKey(authKey);
   
    return getAuthReport(api, auth);
  }
View Full Code Here

  @Override
  public AuthReport checkAllowed(Api api, CanonicalizedIpAddress ip) {
    if(logger.isDebugEnabled()) {
      logger.debug("Checking authentication for IP address [" + ip.getIp() + "] for Api [" + api.getId() + "]");
    }
    Auth auth = this.dataManager.getAuthByIP(ip.getIp());
   
    return getAuthReport(api, auth);
  }
View Full Code Here

TOP

Related Classes of com.alu.e3.data.model.Auth

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.