Search in sources :

Example 1 with OnCommand

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

the class CommandSecurityProvider method filter.

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

Aggregations

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