26.2 User Credential Protocol Implementation

The implementation of the User Credential Protocol is typically found in the file UserCredential.c. Appendix A contains a template for a UserCredential.c file for a UEFI Driver. The list of tasks to implement the User Credential Protocol is as follows:

  • Add global variable for the EFI_USER_CREDENTIAL2_PROTOCOL instance to UserCredential.c.

  • Add implementations of the services produced by the User Credential Protocol to UserCredential.c.

  • Implement HII forms for interacting with the user during the user identify process using a formset GUID of EFI_USER_CREDENTIAL_PROTOCOL_GUID. See Chapter 12 for details on HII forms.

  • Implement HII Config Access Protocol to retrieve and save configuration information associated with the HII forms. See Chapter 12 for details on the HII Config Access Protocol. The implementation of the HII Config Access Protocol is typically found in the file HiiConfigAccess.c. Appendix A contains a template for a HiiConfigAccess.c file for a UEFI Driver.

The example below shows the protocol interface structure for the User Credential Protocol for reference. This protocol is composed of two GUIDs, 11 services, and a capabilities value. These services are used by a User Identity Manager to identify the current user of a platform.

Example 241-User Credential Protocol
typedef struct _EFI_USER_CREDENTIAL2_PROTOCOL EFI_USER_CREDENTIAL2_PROTOCOL;

///
/// This protocol provides support for a single class of credentials
///
struct _EFI_USER_CREDENTIAL2_PROTOCOL {
  EFI_GUID                      Identifier;   ///< Uniquely identifies this
                                              ///< credential provider.
  EFI_GUID                      Type;         ///< Identifies this class of User
                                              ///<Credential Provider.
  EFI_CREDENTIAL2_ENROLL        Enroll;
  EFI_CREDENTIAL2_FORM          Form;
  EFI_CREDENTIAL2_TILE          Tile;
  EFI_CREDENTIAL2_TITLE         Title;
  EFI_CREDENTIAL2_USER          User;
  EFI_CREDENTIAL2_SELECT        Select;
  EFI_CREDENTIAL2_DESELECT      Deselect;
  EFI_CREDENTIAL2_DEFAULT       Default;
  EFI_CREDENTIAL2_GET_INFO      GetInfo;
  EFI_CREDENTIAL2_GET_NEXT_INFO GetNextInfo;
  EFI_CREDENTIAL_CAPABILITIES   Capabilities;
  EFI_CREDENTIAL2_DELETE        Delete;
};

extern EFI_GUID gEfiUserCredential2ProtocolGuid;