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 option to set custom user-agent for token introspector #39

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

StiegOlSauer
Copy link

No description provided.

@@ -154,6 +160,13 @@ func WithJWTParserScopeFilter(scopeFilter jwt.ScopeFilter) JWTParserOption {
}
}

// WithHTTPUserAgent sets the User-Agent header for HTTP requests to JWKS endpoint.
func WithHTTPUserAgent(userAgent string) JWTParserOption {
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 please rename WithHTTPUserAgent to WithJWTParserHTTPUserAgent for consistency with other JWTParser's options?

@@ -173,6 +186,10 @@ func NewTokenIntrospector(
opt(&options)
}

if options.userAgent == "" {
Copy link
Member

Choose a reason for hiding this comment

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

It might be better to use a specified user agent as a prefix, similar to how github.com/grpc/grpc-go does. Currently, the user agent for gRPC requests is "go-authkit/v0.16.0 grpc-go/1.64.1".

With this approach, the final user agent would be:

  • For gRPC: "<user_agent> go-authkit/v0.16.0 grpc-go/1.64.1"
  • For HTTP: "<user_agent> go-authkit/v0.16.0"

@StiegOlSauer, what do you think?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants