<AuthState name="${state.entry}" class="ch.nevis.esauth.auth.states.scripting.ScriptState" final="false" resumeState="true">
	<ResultCond name="done" next="${state.done}"/>
	<ResultCond name="createSamlFedCredential" next="${state.entry}_SamlFedCredential"/>
	<ResultCond name="failure" next="${state.failed}"/>
	<Response value="AUTH_ERROR">
		<Gui name="op_onbrdng_error" label="op-onboarding.process.title">
			<GuiElem name="info" type="info" label="op-onboarding.process.message"/>
			<GuiElem name="lasterror" type="error" label="${notes:lasterrorinfo}" value="${notes:lasterror}"/>
		</Gui>
	</Response>
	<property name="scriptTraceGroup" value="AGOVOP-ACCT"/>
	<property name="script" value="file:///var/opt/nevisauth/default/conf/OpOnbrdng-PostProcessing.groovy"/>
</AuthState>

<AuthState name="${state.entry}_SamlFedCredential" class="ch.nevis.idm.authstate.IdmCreateCredentialState" final="false" resumeState="false">
	<ResultCond name="ok" next="${state.entry}"/>
	<ResultCond name="failed" next="${state.entry}_SamlFedCredential_Failed"/>
	<ResultCond name="credentialExists" next="${state.entry}_SamlFedCredential_Failed"/>
	<ResultCond name="default" next="${state.entry}_SamlFedCredential_Failed"/>
	<Response value="AUTH_CONTINUE">
		<Gui name="NoGui"/>
	</Response>
	<propertyRef name="nevisIDM_Connector"/>
	<property name="user.loginId" value="${sess:ch.adnovum.nevisidm.user.loginId}"/>
	<property name="client.name" value="${sess:ch.adnovum.nevisidm.user.clientName}"/>
	<property name="cred.type" value="saml_federation"/>
	<property name="cred.modificationComment" value="Automatically on-boarded based on assertionId: '${sess:ch.nevis.auth.saml.assertion.id}'"/>
	<property name="cred.state" value="ACTIVE"/>
	<property name="cred.issuerNameId" value="${sess:agov.op.onboarding.homeName}"/>
	<property name="cred.subjectNameId" value="${sess:agov.op.onboarding.subject}"/>
	<property name="operationIfExists" value="ADD"/>
</AuthState>

<AuthState name="${state.entry}_SamlFedCredential_Failed"  class="ch.nevis.esauth.auth.states.standard.TransformAttributes" final="false" resumeState="false">
	<ResultCond name="default" next="${state.failed}"/>
	<Response value="AUTH_CONTINUE">
		<Gui name="NoGui"/>
	</Response>
	<property name="notes:lasterror" value="9905"/>
	<property name="notes:lasterrorinfo" value="Problem with creation of SamlFed credential: ${notes:lasttransition} - ${notes:lasterrorinfo}"/>
</AuthState>
