summaryrefslogtreecommitdiff
path: root/internal/api
diff options
context:
space:
mode:
authorjwijenbergh <jeroenwijenbergh@protonmail.com>2024-09-25 15:32:47 +0200
committerJeroen Wijenbergh <46386452+jwijenbergh@users.noreply.github.com>2024-10-11 17:23:09 +0200
commitbca773c49f0c2e66b5c26a59b8bb772520afb9bd (patch)
treee30c8d5ee9c617b4278d5f21c30906ff61476823 /internal/api
parentdf9b57605b3d8078184e88ec8268102a2b3cc788 (diff)
HTTP + OAuth API: Enforce TLS >= 1.3
Diffstat (limited to 'internal/api')
-rw-r--r--internal/api/api.go8
1 files changed, 7 insertions, 1 deletions
diff --git a/internal/api/api.go b/internal/api/api.go
index fe25862..931f273 100644
--- a/internal/api/api.go
+++ b/internal/api/api.go
@@ -64,6 +64,12 @@ type API struct {
func NewAPI(ctx context.Context, clientID string, sd ServerData, cb Callbacks, tokens *eduoauth.Token) (*API, error) {
cr := customRedirect(clientID)
// Construct OAuth
+
+ transp := sd.Transport
+ // in the tests this can be non-nil
+ if transp == nil {
+ transp = httpw.TLS13Transport()
+ }
o := eduoauth.OAuth{
ClientID: clientID,
EndpointFunc: func(ctx context.Context) (*eduoauth.EndpointResponse, error) {
@@ -81,7 +87,7 @@ func NewAPI(ctx context.Context, clientID string, sd ServerData, cb Callbacks, t
TokensUpdated: func(tok eduoauth.Token) {
cb.TokensUpdated(sd.ID, sd.Type, tok)
},
- Transport: sd.Transport,
+ Transport: transp,
UserAgent: httpw.UserAgent,
}