All Downloads are FREE. Search and download functionalities are using the official Maven repository.

netflix.karyon.examples.hellonoss.common.auth.AuthenticationServiceImpl Maven / Gradle / Ivy

The newest version!
package netflix.karyon.examples.hellonoss.common.auth;

import io.netty.buffer.ByteBuf;
import io.reactivex.netty.protocol.http.server.HttpServerRequest;
import rx.Observable;

/**
 * @author Nitesh Kant
 */
public class AuthenticationServiceImpl implements AuthenticationService {

    public static final String AUTH_HEADER_NAME = "MY-USER-ID";

    @Override
    public Observable authenticate(HttpServerRequest request) {
        if (request.getHeaders().contains(AUTH_HEADER_NAME)) {
            return Observable.just(Boolean.TRUE);
        } else {
            return Observable.error(new IllegalArgumentException("Should pass a header: " + AUTH_HEADER_NAME));
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy