import * as _ from 'lodash' ; import { EidasAttributes , EidasLevelOfAssurances } from '@fc/eidas' ; import { AcrValues } from '@fc/oidc' ; import { OidcScopes } from '../enums' ; param claims return function getPersonIdentifier ( claims ) { return [ claims . sub ] ; } param claims return function getCurrentGivenName ( claims ) { return claims . given_name . split ( ' ' ) ; } param claims return function getCurrentFamilyName ( claims ) { return [ claims . preferred_username || claims . family_name ] ; } param claims return function getBirthName ( claims ) { return [ claims . family_name ] ; } param claims return function getDateOfBirth ( claims ) { return [ claims . birthdate ?. replace ( /-00/g , '-01' ) ] ; } param claims return function getPlaceOfBirth ( claims ) { return [ claims . birthplace || claims . birthcountry ] ; } param claims return function getGender ( claims ) { return [ _ . upperFirst ( claims . gender ) ] ; } export const AcrValuesToLevelOfAssurancesMap = { [ AcrValues . EIDAS1 ] : EidasLevelOfAssurances . LOW , [ AcrValues . EIDAS2 ] : EidasLevelOfAssurances . SUBSTANTIAL , [ AcrValues . EIDAS3 ] : EidasLevelOfAssurances . HIGH , } ; export const ClaimsToAttributesMap = { [ EidasAttributes . PERSON_IDENTIFIER ] : getPersonIdentifier , [ EidasAttributes . CURRENT_GIVEN_NAME ] : getCurrentGivenName , [ EidasAttributes . CURRENT_FAMILY_NAME ] : getCurrentFamilyName , [ EidasAttributes . BIRTH_NAME ] : getBirthName , [ EidasAttributes . DATE_OF_BIRTH ] : getDateOfBirth , [ EidasAttributes . PLACE_OF_BIRTH ] : getPlaceOfBirth , [ EidasAttributes . GENDER ] : getGender , } ; export const ScopesToRequestedAttributesMap = { [ OidcScopes . OPENID ] : [ EidasAttributes . PERSON_IDENTIFIER ] , [ OidcScopes . PROFILE ] : [ EidasAttributes . GENDER , EidasAttributes . DATE_OF_BIRTH , EidasAttributes . CURRENT_GIVEN_NAME , EidasAttributes . CURRENT_FAMILY_NAME , ] , [ OidcScopes . GENDER ] : [ EidasAttributes . GENDER ] , [ OidcScopes . BIRTHDATE ] : [ EidasAttributes . DATE_OF_BIRTH ] , [ OidcScopes . BIRTHPLACE ] : [ EidasAttributes . PLACE_OF_BIRTH ] , [ OidcScopes . GIVEN_NAME ] : [ EidasAttributes . CURRENT_GIVEN_NAME ] , [ OidcScopes . FAMILY_NAME ] : [ EidasAttributes . CURRENT_FAMILY_NAME ] , [ OidcScopes . PREFERRED_USERNAME ] : [ EidasAttributes . CURRENT_FAMILY_NAME ] , } ;