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

Refine Authentication apis, clarify deprecation and migration #2865

Merged
merged 4 commits into from
Oct 11, 2022
Merged
Show file tree
Hide file tree
Changes from 3 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
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
* This class delegates to a typed auth handler once it is certain that the payload appears to be a BasicAuth value.
*/
public class BasicAuthMarshaller implements AuthenticationRequestHandler {
public static final String AUTH_TYPE = Auth2Constants.BASIC_PREFIX.trim();

private final static Logger log = LoggerFactory.getLogger(AnonymousAuthenticationHandler.class);

public interface Handler {
Expand All @@ -41,21 +43,17 @@ public BasicAuthMarshaller(Handler handler) {

@Override
public String getAuthType() {
return Auth2Constants.BASIC_PREFIX.trim();
return AUTH_TYPE;
}

@Override
public void initialize(String targetUrl) {
for (int ii = 0; ii < 5; ++ii) {
log.warn().endl();
}
log.warn().endl().endl().endl().endl().endl();
log.warn().append("================================================================================").endl();
log.warn().append("Basic Authentication is enabled.").endl();
log.warn().append(" Listening on ").append(targetUrl).endl();
log.warn().append("================================================================================").endl();
for (int ii = 0; ii < 5; ++ii) {
log.warn().endl();
}
log.warn().endl().endl().endl().endl().endl();
}

@Override
Expand Down
175 changes: 98 additions & 77 deletions go/internal/proto/session/session.pb.go

Large diffs are not rendered by default.

18 changes: 18 additions & 0 deletions go/internal/proto/session/session_grpc.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,23 @@ service SessionService {
/*
* Handshake between client and server to create a new session. The response includes a metadata header name and the
* token to send on every subsequent request. The auth mechanisms here are unary to best support grpc-web.
*
* Deprecated: Please use Flight's Handshake or http authorization headers instead.
*/
rpc NewSession(HandshakeRequest) returns (HandshakeResponse) {}
rpc NewSession(HandshakeRequest) returns (HandshakeResponse) {
option deprecated = true;
}

/*
* Keep-alive a given token to ensure that a session is not cleaned prematurely. The response may include an updated
* token that should replace the existing token for subsequent requests.
*
* Deprecated: Please use Flight's Handshake with an empty payload.
*/
rpc RefreshSessionToken(HandshakeRequest) returns (HandshakeResponse) {}
rpc RefreshSessionToken(HandshakeRequest) returns (HandshakeResponse) {
option deprecated = true;
}


/*
* Proactively close an open session. Sessions will automatically close on timeout. When a session is closed, all
Expand Down Expand Up @@ -76,15 +85,19 @@ service SessionService {
}

message WrappedAuthenticationRequest {
// do not allow tag 2, since that occurs in flight's BasicAuth
reserved 2;
// do not allow tag 3, since that occurs in flight's BasicAuth
reserved 3;
/*
* The type of the protobuf the auth payload protobuf.
*/
string type = 1;
string type = 4;

/*
* The serialized payload of the protobuf instance.
*/
bytes payload = 2;
bytes payload = 5;
}

/*
Expand All @@ -99,12 +112,12 @@ message HandshakeRequest {
* - protocol = 0: most recent HandshakeResponse payload
* - protocol = 1: payload is BasicAuth
*/
sint32 auth_protocol = 1;
sint32 auth_protocol = 1 [deprecated=true];
Copy link
Member

Choose a reason for hiding this comment

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

Is it possible to deprecate the whole HandshakeRequest object, or no?

Copy link
Member Author

Choose a reason for hiding this comment

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

It appears not. I used the answer at https://stackoverflow.com/a/43380742/860630 to guide this change, and spam the "this is deprecated, plan on us removing it!" notices.


/*
* Arbitrary auth/handshake info.
*/
bytes payload = 2;
bytes payload = 2 [deprecated=true];
}

/*
Expand All @@ -117,23 +130,23 @@ message HandshakeResponse {
/*
* The metadata header to identify the session. This value is static and defined via configuration.
*/
bytes metadata_header = 1;
bytes metadata_header = 1 [deprecated=true];

/*
* Arbitrary session_token to assign to the value to the provided metadata header.
*/
bytes session_token = 2;
bytes session_token = 2 [deprecated=true];

/*
* When this session_token will be considered invalid by the server.
*/
sint64 token_deadline_time_millis = 3 [jstype=JS_STRING];
sint64 token_deadline_time_millis = 3 [jstype=JS_STRING, deprecated = true];

/*
* The length of time that this token was intended to live. Note that `refreshSessionToken` may return the
* existing token to reduce overhead and to prevent denial-of-service caused by refreshing too frequently.
*/
sint64 token_expiration_delay_millis = 4 [jstype=JS_STRING];
sint64 token_expiration_delay_millis = 4 [jstype=JS_STRING, deprecated = true];
}

message CloseSessionResponse {
Expand Down
76 changes: 44 additions & 32 deletions py/client/pydeephaven/proto/session_pb2.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading