Search in sources :

Example 1 with PravegaCredentialsWrapper

use of io.pravega.client.control.impl.PravegaCredentialsWrapper in project pravega by pravega.

the class ControllerGrpcAuthFocusedTest method prepareBlockingCallStubStrict.

private ControllerServiceBlockingStub prepareBlockingCallStubStrict(String username, String password) {
    Exceptions.checkNotNullOrEmpty(username, "username");
    Exceptions.checkNotNullOrEmpty(password, "password");
    ControllerServiceBlockingStub stub = ControllerServiceGrpc.newBlockingStub(inProcessChannelStrict);
    // Set call credentials
    Credentials credentials = new DefaultCredentials(password, username);
    if (credentials != null) {
        PravegaCredentialsWrapper wrapper = new PravegaCredentialsWrapper(credentials);
        stub = stub.withCallCredentials(MoreCallCredentials.from(wrapper));
    }
    return stub;
}
Also used : DefaultCredentials(io.pravega.shared.security.auth.DefaultCredentials) ControllerServiceBlockingStub(io.pravega.controller.stream.api.grpc.v1.ControllerServiceGrpc.ControllerServiceBlockingStub) PravegaCredentialsWrapper(io.pravega.client.control.impl.PravegaCredentialsWrapper) MoreCallCredentials(io.grpc.auth.MoreCallCredentials) DefaultCredentials(io.pravega.shared.security.auth.DefaultCredentials) Credentials(io.pravega.shared.security.auth.Credentials)

Example 2 with PravegaCredentialsWrapper

use of io.pravega.client.control.impl.PravegaCredentialsWrapper in project pravega by pravega.

the class ControllerGrpcAuthFocusedTest method prepareBlockingCallStub.

private ControllerServiceBlockingStub prepareBlockingCallStub(String username, String password) {
    Exceptions.checkNotNullOrEmpty(username, "username");
    Exceptions.checkNotNullOrEmpty(password, "password");
    ControllerServiceBlockingStub stub = ControllerServiceGrpc.newBlockingStub(inProcessChannel);
    // Set call credentials
    Credentials credentials = new DefaultCredentials(password, username);
    if (credentials != null) {
        PravegaCredentialsWrapper wrapper = new PravegaCredentialsWrapper(credentials);
        stub = stub.withCallCredentials(MoreCallCredentials.from(wrapper));
    }
    return stub;
}
Also used : DefaultCredentials(io.pravega.shared.security.auth.DefaultCredentials) ControllerServiceBlockingStub(io.pravega.controller.stream.api.grpc.v1.ControllerServiceGrpc.ControllerServiceBlockingStub) PravegaCredentialsWrapper(io.pravega.client.control.impl.PravegaCredentialsWrapper) MoreCallCredentials(io.grpc.auth.MoreCallCredentials) DefaultCredentials(io.pravega.shared.security.auth.DefaultCredentials) Credentials(io.pravega.shared.security.auth.Credentials)

Example 3 with PravegaCredentialsWrapper

use of io.pravega.client.control.impl.PravegaCredentialsWrapper in project pravega by pravega.

the class ControllerGrpcAuthFocusedTest method prepareNonBlockingCallStub.

private ControllerServiceStub prepareNonBlockingCallStub(String username, String password) {
    Exceptions.checkNotNullOrEmpty(username, "username");
    Exceptions.checkNotNullOrEmpty(password, "password");
    ControllerServiceGrpc.ControllerServiceStub stub = ControllerServiceGrpc.newStub(inProcessChannel);
    // Set call credentials
    Credentials credentials = new DefaultCredentials(password, username);
    if (credentials != null) {
        PravegaCredentialsWrapper wrapper = new PravegaCredentialsWrapper(credentials);
        stub = stub.withCallCredentials(MoreCallCredentials.from(wrapper));
    }
    return stub;
}
Also used : DefaultCredentials(io.pravega.shared.security.auth.DefaultCredentials) ControllerServiceStub(io.pravega.controller.stream.api.grpc.v1.ControllerServiceGrpc.ControllerServiceStub) PravegaCredentialsWrapper(io.pravega.client.control.impl.PravegaCredentialsWrapper) ControllerServiceGrpc(io.pravega.controller.stream.api.grpc.v1.ControllerServiceGrpc) MoreCallCredentials(io.grpc.auth.MoreCallCredentials) DefaultCredentials(io.pravega.shared.security.auth.DefaultCredentials) Credentials(io.pravega.shared.security.auth.Credentials)

Aggregations

MoreCallCredentials (io.grpc.auth.MoreCallCredentials)3 PravegaCredentialsWrapper (io.pravega.client.control.impl.PravegaCredentialsWrapper)3 Credentials (io.pravega.shared.security.auth.Credentials)3 DefaultCredentials (io.pravega.shared.security.auth.DefaultCredentials)3 ControllerServiceBlockingStub (io.pravega.controller.stream.api.grpc.v1.ControllerServiceGrpc.ControllerServiceBlockingStub)2 ControllerServiceGrpc (io.pravega.controller.stream.api.grpc.v1.ControllerServiceGrpc)1 ControllerServiceStub (io.pravega.controller.stream.api.grpc.v1.ControllerServiceGrpc.ControllerServiceStub)1