github.com/mundipagg/boleto-api@v0.0.0-20230620145841-3f9ec742599f/models/authetication.go (about) 1 package models 2 3 // Authentication autenticação para entrada na API do banco 4 type Authentication struct { 5 Username string `json:"Username,omitempty"` 6 Password string `json:"Password,omitempty"` 7 AuthorizationToken string `json:"AuthorizationToken,omitempty"` 8 AccessKey string `json:"AccessKey,omitempty"` 9 } 10 11 func isNotEmptyString(attribute string) bool { 12 return attribute != "" 13 } 14 15 func (a Authentication) maskAuthenticationNode() Authentication { 16 authentication := Authentication{} 17 maskType := "[REDACTED]" 18 19 if isNotEmptyString(a.Username) { 20 authentication.Username = maskType 21 } 22 if isNotEmptyString(a.Password) { 23 authentication.Password = maskType 24 } 25 if isNotEmptyString(a.AuthorizationToken) { 26 authentication.AuthorizationToken = maskType 27 } 28 if isNotEmptyString(a.AccessKey) { 29 authentication.AccessKey = maskType 30 } 31 return authentication 32 }