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