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

Extract auth token from stream and check authorization from WatchDocument #209

Closed
hackerwins opened this issue Jul 6, 2021 · 0 comments · Fixed by #211
Closed

Extract auth token from stream and check authorization from WatchDocument #209

hackerwins opened this issue Jul 6, 2021 · 0 comments · Fixed by #211
Assignees
Labels
enhancement 🌟 New feature or request good first issue 🐤 Good for newcomers

Comments

@hackerwins
Copy link
Member

Description:

Extracting auth token from streams.

// Stream creates a stream server interceptor for authorization.
func (i *AuthInterceptor) Stream() grpc.StreamServerInterceptor {
return func(
srv interface{},
ss grpc.ServerStream,
info *grpc.StreamServerInfo,
handler grpc.StreamHandler,
) error {
// TODO(hackerwins): extract token and store it on the context.
return handler(srv, ss)
}
}

We can use grpc_middleware.WrapServerStream to handle it.

https://github.com/grpc-ecosystem/go-grpc-middleware/blob/93b7816b469d4889200df9121cbe799678bce1bf/auth/auth.go#L51-L67

Why:

Authorization is missing from WatchDocument.

@hackerwins hackerwins added enhancement 🌟 New feature or request good first issue 🐤 Good for newcomers labels Jul 6, 2021
@hackerwins hackerwins self-assigned this Jul 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement 🌟 New feature or request good first issue 🐤 Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant