mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-11 18:33:28 +00:00
feat: actions v2 for functions (#9420)
# Which Problems Are Solved Actions v2 are not executed in different functions, as provided by the actions v1. # How the Problems Are Solved Add functionality to call actions v2 through OIDC and SAML logic to complement tokens and SAMLResponses. # Additional Changes - Corrected testing for retrieved intent information - Added testing for IDP types - Corrected handling of context for issuer in SAML logic # Additional Context - Closes #7247 - Dependent on https://github.com/zitadel/saml/pull/97 - docs for migration are done in separate issue: https://github.com/zitadel/zitadel/issues/9456 --------- Co-authored-by: Silvan <27845747+adlerhurst@users.noreply.github.com>
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package domain
|
||||
|
||||
import (
|
||||
"slices"
|
||||
"time"
|
||||
|
||||
"github.com/zitadel/zitadel/internal/eventstore/v1/models"
|
||||
@@ -45,3 +46,51 @@ const (
|
||||
ActionsMaxAllowed
|
||||
ActionsAllowedUnlimited
|
||||
)
|
||||
|
||||
type ActionFunction int32
|
||||
|
||||
const (
|
||||
ActionFunctionUnspecified ActionFunction = iota
|
||||
ActionFunctionPreUserinfo
|
||||
ActionFunctionPreAccessToken
|
||||
ActionFunctionPreSAMLResponse
|
||||
actionFunctionCount
|
||||
)
|
||||
|
||||
func (s ActionFunction) Valid() bool {
|
||||
return s >= 0 && s < actionFunctionCount
|
||||
}
|
||||
|
||||
func (s ActionFunction) LocalizationKey() string {
|
||||
if !s.Valid() {
|
||||
return ActionFunctionUnspecified.LocalizationKey()
|
||||
}
|
||||
|
||||
switch s {
|
||||
case ActionFunctionPreUserinfo:
|
||||
return "preuserinfo"
|
||||
case ActionFunctionPreAccessToken:
|
||||
return "preaccesstoken"
|
||||
case ActionFunctionPreSAMLResponse:
|
||||
return "presamlresponse"
|
||||
case ActionFunctionUnspecified, actionFunctionCount:
|
||||
fallthrough
|
||||
default:
|
||||
return "unspecified"
|
||||
}
|
||||
}
|
||||
|
||||
func AllActionFunctions() []string {
|
||||
return []string{
|
||||
ActionFunctionPreUserinfo.LocalizationKey(),
|
||||
ActionFunctionPreAccessToken.LocalizationKey(),
|
||||
ActionFunctionPreSAMLResponse.LocalizationKey(),
|
||||
}
|
||||
}
|
||||
|
||||
func ActionFunctionExists() func(string) bool {
|
||||
functions := AllActionFunctions()
|
||||
return func(s string) bool {
|
||||
return slices.Contains(functions, s)
|
||||
}
|
||||
}
|
||||
|
@@ -1,7 +1,6 @@
|
||||
package domain
|
||||
|
||||
import (
|
||||
"slices"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
@@ -150,20 +149,3 @@ func (s TriggerType) LocalizationKey() string {
|
||||
return "Action.TriggerType.Unspecified"
|
||||
}
|
||||
}
|
||||
|
||||
func AllFunctions() []string {
|
||||
functions := make([]string, 0)
|
||||
for _, flowType := range AllFlowTypes() {
|
||||
for _, triggerType := range flowType.TriggerTypes() {
|
||||
functions = append(functions, flowType.LocalizationKey()+"."+triggerType.LocalizationKey())
|
||||
}
|
||||
}
|
||||
return functions
|
||||
}
|
||||
|
||||
func FunctionExists() func(string) bool {
|
||||
functions := AllFunctions()
|
||||
return func(s string) bool {
|
||||
return slices.Contains(functions, s)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user