github.com/projecteru2/core@v0.0.0-20240321043226-06bcc1c23f58/auth/simple/credential.go (about) 1 package simple 2 3 import "context" 4 5 // BasicCredential for basic credential 6 type BasicCredential struct { 7 username string 8 password string 9 } 10 11 // NewBasicCredential new a basic credential 12 func NewBasicCredential(username, password string) *BasicCredential { 13 return &BasicCredential{username, password} 14 } 15 16 // GetRequestMetadata for basic auth 17 func (c BasicCredential) GetRequestMetadata(_ context.Context, _ ...string) (map[string]string, error) { 18 return map[string]string{ 19 c.username: c.password, 20 }, nil 21 } 22 23 // RequireTransportSecurity for ssl require 24 func (c BasicCredential) RequireTransportSecurity() bool { 25 return false 26 }