Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add GetPublicKeys RPC to AuthService for retrieving RSA public key(s) #7982

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions enterprise/server/auth_service/auth_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,7 @@ func (a AuthService) Authenticate(ctx context.Context, req *authpb.AuthenticateR
}
return nil, status.UnauthenticatedError("Authentication failed")
}

func (a AuthService) GetPublicKeys(ctx context.Context, req *authpb.GetPublicKeysRequest) (*authpb.GetPublicKeysResponse, error) {
return &authpb.GetPublicKeysResponse{}, status.UnimplementedError("GetPublicKeys unimplemented")
}
4 changes: 4 additions & 0 deletions enterprise/server/remoteauth/remoteauth_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ func (a *fakeAuthService) Authenticate(ctx context.Context, req *authpb.Authenti
return &authpb.AuthenticateResponse{Jwt: &jwt}, nil
}

func (a *fakeAuthService) GetPublicKeys(ctx context.Context, req *authpb.GetPublicKeysRequest) (*authpb.GetPublicKeysResponse, error) {
return &authpb.GetPublicKeysResponse{}, status.UnimplementedError("GetPublicKeys unimplemented")
}

func setup(t *testing.T) (interfaces.Authenticator, *fakeAuthService) {
fakeAuthService := fakeAuthService{}
te := testenv.GetTestEnv(t)
Expand Down
11 changes: 11 additions & 0 deletions proto/auth.proto
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,17 @@ message AuthenticateResponse {
optional string jwt = 1;
}

message GetPublicKeysRequest {}

message GetPublicKeysResponse {
repeated PublicKey public_keys = 1;
}

message PublicKey {
optional string key = 1;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you add a comment with an example of a public key?

}

service AuthService {
rpc Authenticate(AuthenticateRequest) returns (AuthenticateResponse);
rpc GetPublicKeys(GetPublicKeysRequest) returns (GetPublicKeysResponse);
}
1 change: 1 addition & 0 deletions server/interfaces/interfaces.go
Original file line number Diff line number Diff line change
Expand Up @@ -1553,6 +1553,7 @@ type CodesearchService interface {

type AuthService interface {
Authenticate(ctx context.Context, req *authpb.AuthenticateRequest) (*authpb.AuthenticateResponse, error)
GetPublicKeys(ctx context.Context, req *authpb.GetPublicKeysRequest) (*authpb.GetPublicKeysResponse, error)
}

type RegistryService interface {
Expand Down
Loading