mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-11 21:07:31 +00:00
feat: add http request to interal and external authentication actions (#5103)
Add functionality to provide http.Request and authError to actions for logging or other logic.
This commit is contained in:
@@ -10,7 +10,7 @@ import (
|
||||
"github.com/zitadel/zitadel/internal/domain"
|
||||
)
|
||||
|
||||
// AuthRequestField accepts the domain.AuthRequest by value, so its not mutated
|
||||
// AuthRequestField accepts the domain.AuthRequest by value, so it's not mutated
|
||||
func AuthRequestField(authRequest *domain.AuthRequest) func(c *actions.FieldConfig) interface{} {
|
||||
return func(c *actions.FieldConfig) interface{} {
|
||||
return AuthRequestFromDomain(c, authRequest)
|
||||
@@ -18,6 +18,12 @@ func AuthRequestField(authRequest *domain.AuthRequest) func(c *actions.FieldConf
|
||||
}
|
||||
|
||||
func AuthRequestFromDomain(c *actions.FieldConfig, request *domain.AuthRequest) goja.Value {
|
||||
var maxAuthAge *time.Duration
|
||||
if request.MaxAuthAge != nil {
|
||||
maxAuthAgeCopy := *request.MaxAuthAge
|
||||
maxAuthAge = &maxAuthAgeCopy
|
||||
}
|
||||
|
||||
return c.Runtime.ToValue(&authRequest{
|
||||
Id: request.ID,
|
||||
AgentId: request.AgentID,
|
||||
@@ -34,7 +40,7 @@ func AuthRequestFromDomain(c *actions.FieldConfig, request *domain.AuthRequest)
|
||||
Prompt: request.Prompt,
|
||||
UiLocales: request.UiLocales,
|
||||
LoginHint: request.LoginHint,
|
||||
MaxAuthAge: request.MaxAuthAge,
|
||||
MaxAuthAge: maxAuthAge,
|
||||
InstanceId: request.InstanceID,
|
||||
Request: requestFromDomain(request.Request),
|
||||
UserId: request.UserID,
|
||||
|
Reference in New Issue
Block a user