/
model.go
56 lines (50 loc) · 1.58 KB
/
model.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
package authorization
// Credentials contains OAuth or BasicAuth configuration.
type Credentials struct {
// OAuth is OAuth configuration.
OAuth *OAuth
// BasicAuth is BasicAuth configuration.
BasicAuth *BasicAuth
// CertificateGen is CertificateGen configuration.
CertificateGen *CertificateGen
// CSRFTokenEndpointURL (optional) to fetch CSRF token
CSRFTokenEndpointURL string
}
// BasicAuth contains details of BasicAuth Auth configuration
type BasicAuth struct {
// Username to use for authentication
Username string
// Password to use for authentication
Password string
}
// OAuth contains details of OAuth configuration
type OAuth struct {
// URL to OAuth token provider.
URL string
// ClientID to use for authorization.
ClientID string
// ClientSecret to use for authorization.
ClientSecret string
// RequestParameters will be used with request send by the Application Gateway.
RequestParameters *RequestParameters
}
// CertificateGen details of CertificateGen configuration
type CertificateGen struct {
// CommonName of the certificate
CommonName string
// Certificate generated by Application Registry
Certificate []byte
// PrivateKey generated by Application Registry
PrivateKey []byte
}
// RequestParameters contains Headers and QueryParameters
type RequestParameters struct {
Headers *map[string][]string `json:"headers,omitempty"`
QueryParameters *map[string][]string `json:"queryParameters,omitempty"`
}
func (rp *RequestParameters) unpack() (*map[string][]string, *map[string][]string) {
if rp == nil {
return nil, nil
}
return rp.Headers, rp.QueryParameters
}