[
https://issues.apache.org/jira/browse/TINKERPOP-2747?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17699839#comment-17699839
]
ASF GitHub Bot commented on TINKERPOP-2747:
-------------------------------------------
disq commented on code in PR #1989:
URL: https://github.com/apache/tinkerpop/pull/1989#discussion_r1134639284
##########
gremlin-go/driver/authInfo.go:
##########
@@ -21,29 +21,40 @@ package gremlingo
import "net/http"
-// AuthInfo is an option struct that allows authentication information to be
specified.
-// Authentication can be provided via http.Header Header directly.
+// AuthInfoProvider is an interface that allows authentication information to
be specified.
+type AuthInfoProvider interface {
+ GetHeader() http.Header
+ GetBasicAuth() (ok bool, username, password string)
+}
+
+// AuthInfo is an option struct that allows authentication information to be
specified statically.
+// Authentication can be provided via http.Header directly.
// Basic authentication can also be used via the BasicAuthInfo function.
type AuthInfo struct {
Header http.Header
Username string
Password string
}
-// getHeader provides a safe way to get a header from the AuthInfo even if it
is nil.
+var _ AuthInfoProvider = (*AuthInfo)(nil)
Review Comment:
This is so that we make sure `*AuthInfo` satisfies the `AuthInfoProvider`
interface (compile-time check). More below with `*DynamicAuth`.
> 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)