IKEv2 RFC7296 Section 2.16, provides overview of how IKEv2 is used with EAP. That section states the following when a different identity (IDi) is used in message 2 IKE_AUTH from initiator to responder, eg anonymous@realm, and realId@realm used in EAP identity response:
When the initiator authentication uses EAP, it is possible that the
contents of the IDi payload is used only for Authentication,
Authorization, and Accounting (AAA) routing purposes and selecting
which EAP method to use. This value may be different from the
identity authenticated by the EAP method. It is important that
policy lookups and access control decisions use the actual
authenticated identity. Often the EAP server is implemented in a
separate AAA server that communicates with the IKEv2 responder. In
this case, the authenticated identity, if different from that in the
IDi payload, has to be sent from the AAA server to the IKEv2
responder.
This text is not clear about what identity that the initiator uses in Step 7 below in computing the AUTH:
Initiator Responder
---------------------------------------------
HDR, SAi1, KEi, Ni -->
<-- HDR, SAr1, KEr, Nr, [CERTREQ]
HDR, SK {IDi, [CERTREQ,]
[IDr,] SAi2,
TSi, TSr} -->
<-- HDR, SK {IDr, [CERT,] AUTH,
EAP}
HDR, SK {EAP} -->
<-- HDR, SK {EAP (success)}
HDR, SK {AUTH} -->
<-- HDR, SK {AUTH, SAr2, TSi, TSr}
The AUTH data for initiator is derived as specified in Section 2.15
InitiatorSignedOctets = RealMessage1 | NonceRData | MACedIDForI
where MACedIDforI is "value prf(SK_pi, IDi')" where IDi' is "entire ID payloads excluding the fixed header"
The question is whether IDi used in Step 7 (from initiator to responder: HDR SK {AUTH} -->) should be anonymous@realm (that is the IDi sent in message 3), or realId@realm (the identity provided by initiator in the EAP identity response.