mirror of
https://github.com/element-hq/lk-jwt-service.git
synced 2026-03-29 08:39:55 +00:00
Update golangci/golangci-lint-action action to v8 (#103)
* Update golangci/golangci-lint-action action to v8 * fix ST1005: error strings should not be capitalized * fix : QF1003: could use tagged switch on r.Method * fix: QF1012: Use fmt.Fprintf(...) instead of Write([]byte(fmt.Sprintf(...))) --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: fkwp <github-fkwp@w4ve.de>
This commit is contained in:
11
main.go
11
main.go
@@ -52,7 +52,7 @@ func exchangeOIDCToken(
|
||||
ctx context.Context, token OpenIDTokenType, skipVerifyTLS bool,
|
||||
) (*fclient.UserInfo, error) {
|
||||
if token.AccessToken == "" || token.MatrixServerName == "" {
|
||||
return nil, errors.New("Missing parameters in OIDC token")
|
||||
return nil, errors.New("missing parameters in OIDC token")
|
||||
}
|
||||
|
||||
if skipVerifyTLS {
|
||||
@@ -68,7 +68,7 @@ func exchangeOIDCToken(
|
||||
)
|
||||
if err != nil {
|
||||
log.Printf("Failed to look up user info: %v", err)
|
||||
return nil, errors.New("Failed to look up user info")
|
||||
return nil, errors.New("failed to look up user info")
|
||||
}
|
||||
return &userinfo, nil
|
||||
}
|
||||
@@ -93,10 +93,11 @@ func (h *Handler) handle(w http.ResponseWriter, r *http.Request) {
|
||||
w.Header().Set("Access-Control-Allow-Headers", "Accept, Content-Type, Content-Length, Accept-Encoding, X-CSRF-Token")
|
||||
|
||||
// Handle preflight request (CORS)
|
||||
if r.Method == "OPTIONS" {
|
||||
switch r.Method {
|
||||
case "OPTIONS":
|
||||
w.WriteHeader(http.StatusOK)
|
||||
return
|
||||
} else if r.Method == "POST" {
|
||||
case "POST":
|
||||
var sfu_access_request SFURequest
|
||||
err := json.NewDecoder(r.Body).Decode(&sfu_access_request)
|
||||
if err != nil {
|
||||
@@ -163,7 +164,7 @@ func (h *Handler) handle(w http.ResponseWriter, r *http.Request) {
|
||||
if err != nil {
|
||||
log.Printf("failed to encode json response! %v", err)
|
||||
}
|
||||
} else {
|
||||
default:
|
||||
w.WriteHeader(http.StatusMethodNotAllowed)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user