forked from free5gc/openapi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
auth.go
46 lines (36 loc) · 1.3 KB
/
auth.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
/*
* Nsmf_PDUSession
*
* SMF PDU Session Service
*
* API version: 1.0.0
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
*/
package openapi
// contextKeys are used to identify the type of value in the context.
// Since these are string, it is possible to get a short description of the
// context key for logging and debugging using key.String().
type ContextKey string
// BasicAuth provides basic http authentication to a request passed via context using ContextBasicAuth
type BasicAuth struct {
UserName string `json:"userName,omitempty"`
Password string `json:"password,omitempty"`
}
// APIKey provides API key based authentication to a request passed via context using ContextAPIKey
type APIKey struct {
Key string
Prefix string
}
func (c ContextKey) String() string {
return "auth " + string(c)
}
const (
// ContextOAuth2 takes an oauth2.TokenSource as authentication for the request.
ContextOAuth2 = ContextKey("token")
// ContextBasicAuth takes BasicAuth as authentication for the request.
ContextBasicAuth = ContextKey("basic")
// ContextAccessToken takes a string oauth2 access token as authentication for the request.
ContextAccessToken = ContextKey("accesstoken")
// ContextAPIKey takes an APIKey as authentication for the request
ContextAPIKey = ContextKey("apikey")
)