Search in sources :

Example 1 with SimbaWSAuthenticationException

use of org.simbasecurity.client.interceptor.SimbaWSAuthenticationException in project simba-os by cegeka.

the class BasicAuthenticationFilter method sendRequestAndContinueChain.

private void sendRequestAndContinueChain(RequestData requestData, FilterActionFactory actionFactory) {
    try (THttpClient tHttpClient = new THttpClient(SimbaConfiguration.getSimbaAuthenticationURL())) {
        TProtocol tProtocol = new TJSONProtocol(tHttpClient);
        AuthenticationFilterService.Client authenticationClient = new AuthenticationFilterService.Client(tProtocol);
        ActionDescriptor actionDescriptor = authenticationClient.processRequest(requestData, this.authenticationChainName);
        setPrincipalAndContinueChain(actionFactory, actionDescriptor);
        if (!actionDescriptor.getActionTypes().contains(ActionType.DO_FILTER_AND_SET_PRINCIPAL) && !actionDescriptor.getActionTypes().contains(ActionType.REDIRECT)) {
            throw new SimbaWSAuthenticationException("Authentication Failed");
        }
    } catch (Exception exception) {
        throw new SimbaWSAuthenticationException("Authentication Failed");
    }
}
Also used : TJSONProtocol(org.apache.thrift.protocol.TJSONProtocol) AuthenticationFilterService(org.simbasecurity.api.service.thrift.AuthenticationFilterService) TProtocol(org.apache.thrift.protocol.TProtocol) ActionDescriptor(org.simbasecurity.api.service.thrift.ActionDescriptor) THttpClient(org.apache.thrift.transport.THttpClient) SimbaWSAuthenticationException(org.simbasecurity.client.interceptor.SimbaWSAuthenticationException) THttpClient(org.apache.thrift.transport.THttpClient) IOException(java.io.IOException) SimbaWSAuthenticationException(org.simbasecurity.client.interceptor.SimbaWSAuthenticationException)

Aggregations

IOException (java.io.IOException)1 TJSONProtocol (org.apache.thrift.protocol.TJSONProtocol)1 TProtocol (org.apache.thrift.protocol.TProtocol)1 THttpClient (org.apache.thrift.transport.THttpClient)1 ActionDescriptor (org.simbasecurity.api.service.thrift.ActionDescriptor)1 AuthenticationFilterService (org.simbasecurity.api.service.thrift.AuthenticationFilterService)1 SimbaWSAuthenticationException (org.simbasecurity.client.interceptor.SimbaWSAuthenticationException)1