github.com/GoogleCloudPlatform/terraformer@v0.8.18/providers/keycloak/authentication.go (about) 1 // Copyright 2018 The Terraformer Authors. 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 package keycloak 16 17 import ( 18 "github.com/GoogleCloudPlatform/terraformer/terraformutils" 19 "github.com/mrparkers/terraform-provider-keycloak/keycloak" 20 ) 21 22 func (g RealmGenerator) createAuthenticationFlowResources(authenticationFlows []*keycloak.AuthenticationFlow) []terraformutils.Resource { 23 var resources []terraformutils.Resource 24 for _, authenticationFlow := range authenticationFlows { 25 resources = append(resources, terraformutils.NewResource( 26 authenticationFlow.Id, 27 "authentication_flow_"+normalizeResourceName(authenticationFlow.RealmId)+"_"+normalizeResourceName(authenticationFlow.Id), 28 "keycloak_authentication_flow", 29 "keycloak", 30 map[string]string{ 31 "realm_id": authenticationFlow.RealmId, 32 "alias": authenticationFlow.Alias, 33 }, 34 []string{}, 35 map[string]interface{}{}, 36 )) 37 } 38 return resources 39 } 40 41 func (g RealmGenerator) createAuthenticationSubFlowResource(authenticationSubFlow *keycloak.AuthenticationSubFlow) terraformutils.Resource { 42 resource := terraformutils.NewResource( 43 authenticationSubFlow.Id, 44 "authentication_subflow_"+normalizeResourceName(authenticationSubFlow.RealmId)+"_"+normalizeResourceName(authenticationSubFlow.Id), 45 "keycloak_authentication_subflow", 46 "keycloak", 47 map[string]string{ 48 "realm_id": authenticationSubFlow.RealmId, 49 "parent_flow_alias": authenticationSubFlow.ParentFlowAlias, 50 "alias": authenticationSubFlow.Alias, 51 "requirement": authenticationSubFlow.Requirement, 52 }, 53 []string{}, 54 map[string]interface{}{}, 55 ) 56 return resource 57 } 58 59 func (g RealmGenerator) createAuthenticationExecutionResource(authenticationExecution *keycloak.AuthenticationExecution) terraformutils.Resource { 60 resource := terraformutils.NewResource( 61 authenticationExecution.Id, 62 "authentication_execution_"+normalizeResourceName(authenticationExecution.RealmId)+"_"+normalizeResourceName(authenticationExecution.Id), 63 "keycloak_authentication_execution", 64 "keycloak", 65 map[string]string{ 66 "realm_id": authenticationExecution.RealmId, 67 "parent_flow_alias": authenticationExecution.ParentFlowAlias, 68 "authenticator": authenticationExecution.Authenticator, 69 }, 70 []string{}, 71 map[string]interface{}{}, 72 ) 73 return resource 74 } 75 76 func (g RealmGenerator) createAuthenticationExecutionConfigResource(authenticationExecutionConfig *keycloak.AuthenticationExecutionConfig) terraformutils.Resource { 77 return terraformutils.NewResource( 78 authenticationExecutionConfig.Id, 79 "authentication_execution_config_"+normalizeResourceName(authenticationExecutionConfig.RealmId)+"_"+normalizeResourceName(authenticationExecutionConfig.Id), 80 "keycloak_authentication_execution_config", 81 "keycloak", 82 map[string]string{ 83 "realm_id": authenticationExecutionConfig.RealmId, 84 "execution_id": authenticationExecutionConfig.ExecutionId, 85 "alias": authenticationExecutionConfig.Alias, 86 }, 87 []string{}, 88 map[string]interface{}{ 89 "config": authenticationExecutionConfig.Config, 90 }, 91 ) 92 }