Skip to content

Commit f018021

Browse files
authored
Add jwt_token to service config, remove access_key (#51)
* Add jwt_token to service config, remove access_key * Remove AccessKey from S2S client as it's only meant for web
1 parent 5687053 commit f018021

File tree

2 files changed

+11
-13
lines changed

2 files changed

+11
-13
lines changed

config.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
package authcontrol
22

33
type ServiceConfig struct {
4-
URL string `toml:"url"`
4+
// Base URL of the service.
5+
URL string `toml:"url"`
6+
// JWTSecret is used to create dynamic JWT tokens for S2S auth.
57
JWTSecret string `toml:"jwt_secret"`
6-
AccessKey string `toml:"access_key"`
8+
// JWTToken is a static JWT token for S2S auth.
9+
JWTToken string `toml:"jwt_token"`
710
}

s2s.go

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,13 @@ import (
1414
)
1515

1616
type S2SClientConfig struct {
17-
// JWTToken is the static JWT token used for authentication.
18-
JWTToken string
19-
// JWTSecret is the secret key used to dynamically create JWT BEARER token for authorization.
20-
JWTSecret string
21-
// Service is used in the service claim of the JWT token.
17+
// Service defines the "service" claim in the JWT token.
2218
Service string
23-
// AccessKey is an optional access key used for authentication.
24-
AccessKey string
25-
// DebugRequests enables logging of HTTP requests.
19+
// JWTSecret is used to create dynamic JWT tokens for S2S auth.
20+
JWTSecret string
21+
// JWTToken is a static JWT token for S2S auth.
22+
JWTToken string
23+
// DebugRequests enables HTTP request logging.
2624
DebugRequests bool
2725
}
2826

@@ -44,9 +42,6 @@ func S2SClient(cfg *S2SClientConfig) *http.Client {
4442
transport.If(cfg.JWTToken != "",
4543
transport.SetHeader("Authorization", "BEARER "+cfg.JWTToken),
4644
),
47-
transport.If(cfg.AccessKey != "",
48-
transport.SetHeader("X-Access-Key", cfg.AccessKey),
49-
),
5045
transport.If(cfg.DebugRequests,
5146
transport.LogRequests(transport.LogOptions{Concise: true, CURL: true}),
5247
),

0 commit comments

Comments
 (0)