mirror of
https://github.com/zitadel/zitadel.git
synced 2025-04-08 09:44:33 +00:00

* feat: jwt idp * feat: command side * feat: add tests * fill idp views with jwt idps and return apis * add jwtEndpoint to jwt idp * begin jwt request handling * merge * handle jwt idp * cleanup * fixes * autoregister * get token from specific header name * error handling * fix texts * handle renderExternalNotFoundOption Co-authored-by: fabi <fabienne.gerschwiler@gmail.com>
37 lines
894 B
Go
37 lines
894 B
Go
package handler
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
"github.com/caos/zitadel/internal/domain"
|
|
|
|
http_mw "github.com/caos/zitadel/internal/api/http/middleware"
|
|
)
|
|
|
|
const (
|
|
queryAuthRequestID = "authRequestID"
|
|
queryUserAgentID = "userAgentID"
|
|
)
|
|
|
|
func (l *Login) getAuthRequest(r *http.Request) (*domain.AuthRequest, error) {
|
|
authRequestID := r.FormValue(queryAuthRequestID)
|
|
if authRequestID == "" {
|
|
return nil, nil
|
|
}
|
|
userAgentID, _ := http_mw.UserAgentIDFromCtx(r.Context())
|
|
return l.authRepo.AuthRequestByID(r.Context(), authRequestID, userAgentID)
|
|
}
|
|
|
|
func (l *Login) getAuthRequestAndParseData(r *http.Request, data interface{}) (*domain.AuthRequest, error) {
|
|
authReq, err := l.getAuthRequest(r)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
err = l.parser.Parse(r, data)
|
|
return authReq, err
|
|
}
|
|
|
|
func (l *Login) getParseData(r *http.Request, data interface{}) error {
|
|
return l.parser.Parse(r, data)
|
|
}
|