AuthKind returns the credential kind using explicit metadata first and legacy field-shape fallbacks second.
()
| 24 | // AuthKind returns the credential kind using explicit metadata first and legacy |
| 25 | // field-shape fallbacks second. |
| 26 | func (a *Auth) AuthKind() string { |
| 27 | if a == nil { |
| 28 | return "" |
| 29 | } |
| 30 | if kind := normalizeAuthKind(authAttribute(a, AttributeAuthKind)); kind != "" { |
| 31 | return kind |
| 32 | } |
| 33 | if kind := normalizeAuthKind(authMetadataString(a, AttributeAuthKind)); kind != "" { |
| 34 | return kind |
| 35 | } |
| 36 | if authAttribute(a, AttributeAPIKey) != "" { |
| 37 | return AuthKindAPIKey |
| 38 | } |
| 39 | if authHasOAuthMetadata(a) { |
| 40 | return AuthKindOAuth |
| 41 | } |
| 42 | return "" |
| 43 | } |
| 44 | |
| 45 | // AuthSourceKind returns where the Auth entry came from at runtime. |
| 46 | func (a *Auth) AuthSourceKind() string { |