Implement Authentication Filter (2.1.3.3)

This commit is contained in:
2021-04-29 17:37:23 +02:00
parent 1e96417a3f
commit 1363e83aa3
7 changed files with 161 additions and 8 deletions
@@ -11,6 +11,7 @@ import io.grpc.ServerBuilder;
import io.grpc.stub.StreamObserver;
import javax.annotation.Resource;
import javax.inject.Inject;
import javax.inject.Named;
import javax.inject.Singleton;
import java.io.IOException;
@@ -20,7 +21,7 @@ import java.io.IOException;
public class GrpcServerRunner extends AuthServiceGrpc.AuthServiceImplBase implements IGrpcServerRunner {
@Resource
private GrpcServerProperties properties;
@Resource
@Inject
private IAuthenticationService authenticationService;
@Override
@@ -37,7 +38,7 @@ public class GrpcServerRunner extends AuthServiceGrpc.AuthServiceImplBase implem
AuthenticationResponse response;
try {
String token = authenticationService.authenticate(request.getEmail(), request.getPassword());
response = AuthenticationResponse.newBuilder().setToken(token).build();
response = AuthenticationResponse.newBuilder().setStatus("").setToken(token).build();
} catch (NoSuchUserException e){
response = AuthenticationResponse.newBuilder().setStatus("NoSuchUserException").build();
} catch (AuthenticationException e) {