[
https://issues.apache.org/jira/browse/TINKERPOP-2747?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17700028#comment-17700028
]
ASF GitHub Bot commented on TINKERPOP-2747:
-------------------------------------------
disq commented on code in PR #1989:
URL: https://github.com/apache/tinkerpop/pull/1989#discussion_r1135197255
##########
gremlin-go/driver/authInfo.go:
##########
@@ -55,3 +66,30 @@ func BasicAuthInfo(username string, password string)
*AuthInfo {
func HeaderAuthInfo(header http.Header) *AuthInfo {
return &AuthInfo{Header: header}
}
+
+// DynamicAuth is an AuthInfoProvider that allows dynamic credential
generation.
+type DynamicAuth struct {
+ fn func() AuthInfoProvider
+}
+
+var (
+ _ AuthInfoProvider = (*DynamicAuth)(nil)
+
+ // NoopAuthInfo is a no-op AuthInfoProvider that can be used to disable
authentication.
+ NoopAuthInfo = NewDynamicAuth(func() AuthInfoProvider { return
&AuthInfo{} })
Review Comment:
This is implemented as dynamic auth so that the returned value can't be
changed after use, e.g. by setting the public fields of the AuthInfo struct.
> Add function callback hooks for gremlin-go authentication
> ---------------------------------------------------------
>
> Key: TINKERPOP-2747
> URL: https://issues.apache.org/jira/browse/TINKERPOP-2747
> Project: TinkerPop
> Issue Type: Improvement
> Components: go
> Reporter: Lyndon Bauto
> Priority: Major
>
> Gremlin Go currently supports custom authentication headers.
>
> For long running connections that reconnect over time, these headers can
> expire.
>
> We should allow injection of a function pointer to generate the header.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)