Search in sources :

Example 1 with OnConnection

use of org.talend.sdk.component.server.service.security.event.OnConnection in project component-runtime by Talend.

the class ConnectionSecurityProvider method filter.

@Override
public void filter(final ContainerRequestContext requestContext) throws IOException {
    if (Boolean.TRUE.equals(request.getAttribute(SKIP))) {
        return;
    }
    final OnConnection onConnection = new OnConnection();
    onConnectionEvent.fire(onConnection);
    if (!onConnection.isValid()) {
        requestContext.abortWith(Response.status(Response.Status.UNAUTHORIZED).entity(new ErrorPayload(UNAUTHORIZED, "Invalid connection credentials")).type(APPLICATION_JSON_TYPE).build());
    }
}
Also used : OnConnection(org.talend.sdk.component.server.service.security.event.OnConnection) ErrorPayload(org.talend.sdk.component.server.front.model.error.ErrorPayload)

Aggregations

ErrorPayload (org.talend.sdk.component.server.front.model.error.ErrorPayload)1 OnConnection (org.talend.sdk.component.server.service.security.event.OnConnection)1