From 947769d4999ac1b77e9aee26b2c7cc26ceac70f1 Mon Sep 17 00:00:00 2001 From: kevin Date: Thu, 16 May 2019 22:01:31 +0200 Subject: [PATCH 1/5] authentication service spec --- protos/services/authentication_service.proto | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/protos/services/authentication_service.proto b/protos/services/authentication_service.proto index 2933b8f..34cc016 100644 --- a/protos/services/authentication_service.proto +++ b/protos/services/authentication_service.proto @@ -10,5 +10,11 @@ message SigninRequest { } service AuthenticationService { + /// In the metadata the client will find the Authorization key with the token + /// in the value rpc signin(SigninRequest) returns (google.protobuf.Empty); + + /// The client must send in the metadata the Authorization key with the token + /// in the value + rpc signout(google.protobuf.Empty) returns (google.protobuf.Empty); } \ No newline at end of file From e2aa306ea15600bcd9e0849198807c888cbdb864 Mon Sep 17 00:00:00 2001 From: kevin Date: Thu, 16 May 2019 22:10:05 +0200 Subject: [PATCH 2/5] add isLogged endpoint --- protos/services/authentication_service.proto | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/protos/services/authentication_service.proto b/protos/services/authentication_service.proto index 34cc016..f4baaf4 100644 --- a/protos/services/authentication_service.proto +++ b/protos/services/authentication_service.proto @@ -17,4 +17,9 @@ service AuthenticationService { /// The client must send in the metadata the Authorization key with the token /// in the value rpc signout(google.protobuf.Empty) returns (google.protobuf.Empty); + + /// If the user is logged return Empty else throw GrpcError.unauthenticated + /// The client must send in the metadata the Authorization key with the token + /// in the value + rpc isLogged(google.protobuf.Empty) returns (google.protobuf.Empty); } \ No newline at end of file From 51467085f228326dd3739bee27ae2a62afd93d4f Mon Sep 17 00:00:00 2001 From: kevin Date: Thu, 16 May 2019 22:11:49 +0200 Subject: [PATCH 3/5] improve comment --- protos/services/authentication_service.proto | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/protos/services/authentication_service.proto b/protos/services/authentication_service.proto index f4baaf4..a4ef977 100644 --- a/protos/services/authentication_service.proto +++ b/protos/services/authentication_service.proto @@ -10,15 +10,16 @@ message SigninRequest { } service AuthenticationService { - /// In the metadata the client will find the Authorization key with the token - /// in the value + /// In the metadata the client will find the Authorization key with the token + /// in the value rpc signin(SigninRequest) returns (google.protobuf.Empty); /// The client must send in the metadata the Authorization key with the token /// in the value rpc signout(google.protobuf.Empty) returns (google.protobuf.Empty); - /// If the user is logged return Empty else throw GrpcError.unauthenticated + /// If the user is logged return Empty else throw GrpcError. + /// /// The client must send in the metadata the Authorization key with the token /// in the value rpc isLogged(google.protobuf.Empty) returns (google.protobuf.Empty); From 59d88c729885f664e01910c1d709ce3da792b573 Mon Sep 17 00:00:00 2001 From: kevin Date: Thu, 16 May 2019 22:13:07 +0200 Subject: [PATCH 4/5] generate code for authentication service --- .../authentication_service.pbgrpc.dart | 48 +++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/common/generated_io/lib/src/services/authentication_service.pbgrpc.dart b/common/generated_io/lib/src/services/authentication_service.pbgrpc.dart index efc7bab..552ea4f 100644 --- a/common/generated_io/lib/src/services/authentication_service.pbgrpc.dart +++ b/common/generated_io/lib/src/services/authentication_service.pbgrpc.dart @@ -17,6 +17,14 @@ class AuthenticationServiceClient extends Client { '/stashall.AuthenticationService/signin', (SigninRequest value) => value.writeToBuffer(), (List value) => new $0.Empty.fromBuffer(value)); + static final _$signout = new ClientMethod<$0.Empty, $0.Empty>( + '/stashall.AuthenticationService/signout', + ($0.Empty value) => value.writeToBuffer(), + (List value) => new $0.Empty.fromBuffer(value)); + static final _$isLogged = new ClientMethod<$0.Empty, $0.Empty>( + '/stashall.AuthenticationService/isLogged', + ($0.Empty value) => value.writeToBuffer(), + (List value) => new $0.Empty.fromBuffer(value)); AuthenticationServiceClient(ClientChannel channel, {CallOptions options}) : super(channel, options: options); @@ -28,6 +36,20 @@ class AuthenticationServiceClient extends Client { options: options); return new ResponseFuture(call); } + + ResponseFuture<$0.Empty> signout($0.Empty request, {CallOptions options}) { + final call = $createCall( + _$signout, new $async.Stream.fromIterable([request]), + options: options); + return new ResponseFuture(call); + } + + ResponseFuture<$0.Empty> isLogged($0.Empty request, {CallOptions options}) { + final call = $createCall( + _$isLogged, new $async.Stream.fromIterable([request]), + options: options); + return new ResponseFuture(call); + } } abstract class AuthenticationServiceBase extends Service { @@ -41,6 +63,20 @@ abstract class AuthenticationServiceBase extends Service { false, (List value) => new SigninRequest.fromBuffer(value), ($0.Empty value) => value.writeToBuffer())); + $addMethod(new ServiceMethod<$0.Empty, $0.Empty>( + 'signout', + signout_Pre, + false, + false, + (List value) => new $0.Empty.fromBuffer(value), + ($0.Empty value) => value.writeToBuffer())); + $addMethod(new ServiceMethod<$0.Empty, $0.Empty>( + 'isLogged', + isLogged_Pre, + false, + false, + (List value) => new $0.Empty.fromBuffer(value), + ($0.Empty value) => value.writeToBuffer())); } $async.Future<$0.Empty> signin_Pre( @@ -48,5 +84,17 @@ abstract class AuthenticationServiceBase extends Service { return signin(call, await request); } + $async.Future<$0.Empty> signout_Pre( + ServiceCall call, $async.Future request) async { + return signout(call, await request); + } + + $async.Future<$0.Empty> isLogged_Pre( + ServiceCall call, $async.Future request) async { + return isLogged(call, await request); + } + $async.Future<$0.Empty> signin(ServiceCall call, SigninRequest request); + $async.Future<$0.Empty> signout(ServiceCall call, $0.Empty request); + $async.Future<$0.Empty> isLogged(ServiceCall call, $0.Empty request); } From bb1b3554d6a7b055c472c32b7ecf81e481810fe6 Mon Sep 17 00:00:00 2001 From: kevin Date: Thu, 16 May 2019 22:48:08 +0200 Subject: [PATCH 5/5] Revert "generate code for authentication service" This reverts commit 59d88c729885f664e01910c1d709ce3da792b573. --- .../authentication_service.pbgrpc.dart | 48 ------------------- 1 file changed, 48 deletions(-) diff --git a/common/generated_io/lib/src/services/authentication_service.pbgrpc.dart b/common/generated_io/lib/src/services/authentication_service.pbgrpc.dart index 552ea4f..efc7bab 100644 --- a/common/generated_io/lib/src/services/authentication_service.pbgrpc.dart +++ b/common/generated_io/lib/src/services/authentication_service.pbgrpc.dart @@ -17,14 +17,6 @@ class AuthenticationServiceClient extends Client { '/stashall.AuthenticationService/signin', (SigninRequest value) => value.writeToBuffer(), (List value) => new $0.Empty.fromBuffer(value)); - static final _$signout = new ClientMethod<$0.Empty, $0.Empty>( - '/stashall.AuthenticationService/signout', - ($0.Empty value) => value.writeToBuffer(), - (List value) => new $0.Empty.fromBuffer(value)); - static final _$isLogged = new ClientMethod<$0.Empty, $0.Empty>( - '/stashall.AuthenticationService/isLogged', - ($0.Empty value) => value.writeToBuffer(), - (List value) => new $0.Empty.fromBuffer(value)); AuthenticationServiceClient(ClientChannel channel, {CallOptions options}) : super(channel, options: options); @@ -36,20 +28,6 @@ class AuthenticationServiceClient extends Client { options: options); return new ResponseFuture(call); } - - ResponseFuture<$0.Empty> signout($0.Empty request, {CallOptions options}) { - final call = $createCall( - _$signout, new $async.Stream.fromIterable([request]), - options: options); - return new ResponseFuture(call); - } - - ResponseFuture<$0.Empty> isLogged($0.Empty request, {CallOptions options}) { - final call = $createCall( - _$isLogged, new $async.Stream.fromIterable([request]), - options: options); - return new ResponseFuture(call); - } } abstract class AuthenticationServiceBase extends Service { @@ -63,20 +41,6 @@ abstract class AuthenticationServiceBase extends Service { false, (List value) => new SigninRequest.fromBuffer(value), ($0.Empty value) => value.writeToBuffer())); - $addMethod(new ServiceMethod<$0.Empty, $0.Empty>( - 'signout', - signout_Pre, - false, - false, - (List value) => new $0.Empty.fromBuffer(value), - ($0.Empty value) => value.writeToBuffer())); - $addMethod(new ServiceMethod<$0.Empty, $0.Empty>( - 'isLogged', - isLogged_Pre, - false, - false, - (List value) => new $0.Empty.fromBuffer(value), - ($0.Empty value) => value.writeToBuffer())); } $async.Future<$0.Empty> signin_Pre( @@ -84,17 +48,5 @@ abstract class AuthenticationServiceBase extends Service { return signin(call, await request); } - $async.Future<$0.Empty> signout_Pre( - ServiceCall call, $async.Future request) async { - return signout(call, await request); - } - - $async.Future<$0.Empty> isLogged_Pre( - ServiceCall call, $async.Future request) async { - return isLogged(call, await request); - } - $async.Future<$0.Empty> signin(ServiceCall call, SigninRequest request); - $async.Future<$0.Empty> signout(ServiceCall call, $0.Empty request); - $async.Future<$0.Empty> isLogged(ServiceCall call, $0.Empty request); }