...
1
9
10 package unannotatedecho
11
12 import (
13 "net/http"
14 )
15
16
17
18
19
20 type contextKey string
21
22 func (c contextKey) String() string {
23 return "auth " + string(c)
24 }
25
26 var (
27
28 ContextOAuth2 = contextKey("token")
29
30
31 ContextBasicAuth = contextKey("basic")
32
33
34 ContextAccessToken = contextKey("accesstoken")
35
36
37 ContextAPIKey = contextKey("apikey")
38 )
39
40
41 type BasicAuth struct {
42 UserName string `json:"userName,omitempty"`
43 Password string `json:"password,omitempty"`
44 }
45
46
47 type APIKey struct {
48 Key string
49 Prefix string
50 }
51
52 type Configuration struct {
53 BasePath string `json:"basePath,omitempty"`
54 Host string `json:"host,omitempty"`
55 Scheme string `json:"scheme,omitempty"`
56 DefaultHeader map[string]string `json:"defaultHeader,omitempty"`
57 UserAgent string `json:"userAgent,omitempty"`
58 HTTPClient *http.Client
59 }
60
61 func NewConfiguration() *Configuration {
62 cfg := &Configuration{
63 BasePath: "https://localhost",
64 DefaultHeader: make(map[string]string),
65 UserAgent: "Swagger-Codegen/1.0.0/go",
66 }
67 return cfg
68 }
69
70 func (c *Configuration) AddDefaultHeader(key string, value string) {
71 c.DefaultHeader[key] = value
72 }
73
View as plain text