mirror of
https://github.com/zitadel/zitadel.git
synced 2025-06-20 12:58:32 +00:00
fix: send exhausted property in env json (#5877)
This commit is contained in:
parent
80815e89cf
commit
885e3385aa
@ -116,12 +116,13 @@ func Start(config Config, externalSecure bool, issuer op.IssuerFromRequest, call
|
|||||||
http.Error(w, fmt.Sprintf("unable to template instance management url for console: %v", err), http.StatusInternalServerError)
|
http.Error(w, fmt.Sprintf("unable to template instance management url for console: %v", err), http.StatusInternalServerError)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
environmentJSON, err := createEnvironmentJSON(url, issuer(r), instance.ConsoleClientID(), customerPortal, instanceMgmtURL)
|
exhausted := limitingAccessInterceptor.Limit(ctx)
|
||||||
|
environmentJSON, err := createEnvironmentJSON(url, issuer(r), instance.ConsoleClientID(), customerPortal, instanceMgmtURL, exhausted)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
http.Error(w, fmt.Sprintf("unable to marshal env for console: %v", err), http.StatusInternalServerError)
|
http.Error(w, fmt.Sprintf("unable to marshal env for console: %v", err), http.StatusInternalServerError)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if limitingAccessInterceptor.Limit(ctx) {
|
if exhausted {
|
||||||
limitingAccessInterceptor.SetExhaustedCookie(w, r)
|
limitingAccessInterceptor.SetExhaustedCookie(w, r)
|
||||||
} else {
|
} else {
|
||||||
limitingAccessInterceptor.DeleteExhaustedCookie(w, r)
|
limitingAccessInterceptor.DeleteExhaustedCookie(w, r)
|
||||||
@ -154,19 +155,21 @@ func csp() *middleware.CSP {
|
|||||||
return &csp
|
return &csp
|
||||||
}
|
}
|
||||||
|
|
||||||
func createEnvironmentJSON(api, issuer, clientID, customerPortal, instanceMgmtUrl string) ([]byte, error) {
|
func createEnvironmentJSON(api, issuer, clientID, customerPortal, instanceMgmtUrl string, exhausted bool) ([]byte, error) {
|
||||||
environment := struct {
|
environment := struct {
|
||||||
API string `json:"api,omitempty"`
|
API string `json:"api,omitempty"`
|
||||||
Issuer string `json:"issuer,omitempty"`
|
Issuer string `json:"issuer,omitempty"`
|
||||||
ClientID string `json:"clientid,omitempty"`
|
ClientID string `json:"clientid,omitempty"`
|
||||||
CustomerPortal string `json:"customer_portal,omitempty"`
|
CustomerPortal string `json:"customer_portal,omitempty"`
|
||||||
InstanceManagementURL string `json:"instance_management_url,omitempty"`
|
InstanceManagementURL string `json:"instance_management_url,omitempty"`
|
||||||
|
Exhausted bool `json:"exhausted,omitempty"`
|
||||||
}{
|
}{
|
||||||
API: api,
|
API: api,
|
||||||
Issuer: issuer,
|
Issuer: issuer,
|
||||||
ClientID: clientID,
|
ClientID: clientID,
|
||||||
CustomerPortal: customerPortal,
|
CustomerPortal: customerPortal,
|
||||||
InstanceManagementURL: instanceMgmtUrl,
|
InstanceManagementURL: instanceMgmtUrl,
|
||||||
|
Exhausted: exhausted,
|
||||||
}
|
}
|
||||||
return json.Marshal(environment)
|
return json.Marshal(environment)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user