MCPcopy
hub / github.com/oauth2-proxy/oauth2-proxy / Authenticate

Method Authenticate

oauthproxy_test.go:1509–1531  ·  view source on GitHub ↗
(w http.ResponseWriter, r *http.Request)

Source from the content-addressed store, hash-verified

1507}
1508
1509func (v *SignatureAuthenticator) Authenticate(w http.ResponseWriter, r *http.Request) {
1510 result, headerSig, computedSig := v.auth.AuthenticateRequest(r)
1511
1512 var msg string
1513 switch result {
1514 case hmacauth.ResultNoSignature:
1515 msg = "no signature received"
1516 case hmacauth.ResultMatch:
1517 msg = "signatures match"
1518 case hmacauth.ResultMismatch:
1519 msg = fmt.Sprintf(
1520 "signatures do not match:\n received: %s\n computed: %s",
1521 headerSig,
1522 computedSig)
1523 default:
1524 panic("unknown result value: " + result.String())
1525 }
1526
1527 _, err := w.Write([]byte(msg))
1528 if err != nil {
1529 panic(err)
1530 }
1531}
1532
1533type SignatureTest struct {
1534 opts *options.Options

Callers

nothing calls this directly

Calls 3

AuthenticateRequestMethod · 0.65
StringMethod · 0.45
WriteMethod · 0.45

Tested by

no test coverage detected