1 /** @file
2   UEFI 2.3.1 User Credential Protocol definition.
3 
4   Attached to a device handle, this protocol identifies a single means of identifying the user.
5 
6   Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>
7   SPDX-License-Identifier: BSD-2-Clause-Patent
8 
9 **/
10 
11 #ifndef __USER_CREDENTIAL2_H__
12 #define __USER_CREDENTIAL2_H__
13 
14 #include <Protocol/UserManager.h>
15 
16 #define EFI_USER_CREDENTIAL2_PROTOCOL_GUID \
17   { \
18     0xe98adb03, 0xb8b9, 0x4af8, { 0xba, 0x20, 0x26, 0xe9, 0x11, 0x4c, 0xbc, 0xe5 } \
19   }
20 
21 typedef struct _EFI_USER_CREDENTIAL2_PROTOCOL  EFI_USER_CREDENTIAL2_PROTOCOL;
22 
23 /**
24   Enroll a user on a credential provider.
25 
26   This function enrolls a user on this credential provider. If the user exists on this credential
27   provider, update the user information on this credential provider; otherwise add the user information
28   on credential provider.
29 
30   @param[in] This                Points to this instance of the EFI_USER_CREDENTIAL2_PROTOCOL.
31   @param[in] User                The user profile to enroll.
32 
33   @retval EFI_SUCCESS            User profile was successfully enrolled.
34   @retval EFI_ACCESS_DENIED      Current user profile does not permit enrollment on the user profile
35                                  handle. Either the user profile cannot enroll on any user profile or
36                                  cannot enroll on a user profile other than the current user profile.
37   @retval EFI_UNSUPPORTED        This credential provider does not support enrollment in the pre-OS.
38   @retval EFI_DEVICE_ERROR       The new credential could not be created because of a device error.
39   @retval EFI_INVALID_PARAMETER  User does not refer to a valid user profile handle.
40 **/
41 typedef
42 EFI_STATUS
43 (EFIAPI *EFI_CREDENTIAL2_ENROLL)(
44   IN CONST EFI_USER_CREDENTIAL2_PROTOCOL  *This,
45   IN       EFI_USER_PROFILE_HANDLE        User
46   );
47 
48 /**
49   Returns the user interface information used during user identification.
50 
51   This function returns information about the form used when interacting with the user during user
52   identification. The form is the first enabled form in the form-set class
53   EFI_HII_USER_CREDENTIAL_FORMSET_GUID installed on the HII handle HiiHandle. If
54   the user credential provider does not require a form to identify the user, then this function should
55   return EFI_NOT_FOUND.
56 
57   @param[in]  This               Points to this instance of the EFI_USER_CREDENTIAL2_PROTOCOL.
58   @param[out] Hii                On return, holds the HII database handle.
59   @param[out] FormSetId          On return, holds the identifier of the form set which contains
60                                  the form used during user identification.
61   @param[out] FormId             On return, holds the identifier of the form used during user
62                                  identification.
63 
64   @retval EFI_SUCCESS            Form returned successfully.
65   @retval EFI_NOT_FOUND          Form not returned.
66   @retval EFI_INVALID_PARAMETER  Hii is NULL or FormSetId is NULL or FormId is NULL.
67 **/
68 typedef
69 EFI_STATUS
70 (EFIAPI *EFI_CREDENTIAL2_FORM)(
71   IN CONST EFI_USER_CREDENTIAL2_PROTOCOL *This,
72   OUT      EFI_HII_HANDLE                *Hii,
73   OUT      EFI_GUID                      *FormSetId,
74   OUT      EFI_FORM_ID                   *FormId
75   );
76 
77 /**
78   Returns bitmap used to describe the credential provider type.
79 
80   This optional function returns a bitmap which is less than or equal to the number of pixels specified
81   by Width and Height. If no such bitmap exists, then EFI_NOT_FOUND is returned.
82 
83   @param[in]      This           Points to this instance of the EFI_USER_CREDENTIAL2_PROTOCOL.
84   @param[in, out] Width          On entry, points to the desired bitmap width. If NULL then no bitmap
85                                  information will be returned. On exit, points to the width of the
86                                  bitmap returned.
87   @param[in, out] Height         On entry, points to the desired bitmap height. If NULL then no bitmap
88                                  information will be returned. On exit, points to the height of the
89                                  bitmap returned
90   @param[out]     Hii            On return, holds the HII database handle.
91   @param[out]     Image          On return, holds the HII image identifier.
92 
93   @retval EFI_SUCCESS            Image identifier returned successfully.
94   @retval EFI_NOT_FOUND          Image identifier not returned.
95   @retval EFI_INVALID_PARAMETER  Hii is NULL or Image is NULL.
96 **/
97 typedef
98 EFI_STATUS
99 (EFIAPI *EFI_CREDENTIAL2_TILE)(
100   IN CONST EFI_USER_CREDENTIAL2_PROTOCOL *This,
101   IN OUT   UINTN                         *Width,
102   IN OUT   UINTN                         *Height,
103   OUT      EFI_HII_HANDLE                *Hii,
104   OUT      EFI_IMAGE_ID                  *Image
105   );
106 
107 /**
108   Returns string used to describe the credential provider type.
109 
110   This function returns a string which describes the credential provider. If no such string exists, then
111   EFI_NOT_FOUND is returned.
112 
113   @param[in]  This               Points to this instance of the EFI_USER_CREDENTIAL2_PROTOCOL.
114   @param[out] Hii                On return, holds the HII database handle.
115   @param[out] String             On return, holds the HII string identifier.
116 
117   @retval EFI_SUCCESS            String identifier returned successfully.
118   @retval EFI_NOT_FOUND          String identifier not returned.
119   @retval EFI_INVALID_PARAMETER  Hii is NULL or String is NULL.
120 **/
121 typedef
122 EFI_STATUS
123 (EFIAPI *EFI_CREDENTIAL2_TITLE)(
124   IN CONST EFI_USER_CREDENTIAL2_PROTOCOL *This,
125   OUT      EFI_HII_HANDLE                *Hii,
126   OUT      EFI_STRING_ID                 *String
127   );
128 
129 /**
130   Return the user identifier associated with the currently authenticated user.
131 
132   This function returns the user identifier of the user authenticated by this credential provider. This
133   function is called after the credential-related information has been submitted on a form OR after a
134   call to Default() has returned that this credential is ready to log on.
135 
136   @param[in]  This               Points to this instance of the EFI_USER_CREDENTIAL2_PROTOCOL.
137   @param[in]  User               The user profile handle of the user profile currently being considered
138                                  by the user identity manager. If NULL, then no user profile is currently
139                                  under consideration.
140   @param[out] Identifier         On return, points to the user identifier.
141 
142   @retval EFI_SUCCESS            User identifier returned successfully.
143   @retval EFI_NOT_READY          No user identifier can be returned.
144   @retval EFI_ACCESS_DENIED      The user has been locked out of this user credential.
145   @retval EFI_NOT_FOUND          User is not NULL, and the specified user handle can't be found in user
146                                  profile database
147   @retval EFI_INVALID_PARAMETER  Identifier is NULL.
148 **/
149 typedef
150 EFI_STATUS
151 (EFIAPI *EFI_CREDENTIAL2_USER)(
152   IN CONST EFI_USER_CREDENTIAL2_PROTOCOL *This,
153   IN       EFI_USER_PROFILE_HANDLE       User,
154   OUT      EFI_USER_INFO_IDENTIFIER      *Identifier
155   );
156 
157 /**
158   Indicate that user interface interaction has begun for the specified credential.
159 
160   This function is called when a credential provider is selected by the user. If AutoLogon returns
161   FALSE, then the user interface will be constructed by the User Identity Manager.
162 
163   @param[in]  This               Points to this instance of the EFI_USER_CREDENTIAL2_PROTOCOL.
164   @param[out] AutoLogon          On return, points to the credential provider's capabilities after
165                                  the credential provider has been selected by the user.
166 
167   @retval EFI_SUCCESS            Credential provider successfully selected.
168   @retval EFI_INVALID_PARAMETER  AutoLogon is NULL.
169 **/
170 typedef
171 EFI_STATUS
172 (EFIAPI *EFI_CREDENTIAL2_SELECT)(
173   IN CONST EFI_USER_CREDENTIAL2_PROTOCOL *This,
174   OUT      EFI_CREDENTIAL_LOGON_FLAGS    *AutoLogon
175   );
176 
177 /**
178   Indicate that user interface interaction has ended for the specified credential.
179 
180   This function is called when a credential provider is deselected by the user.
181 
182   @param[in] This        Points to this instance of the EFI_USER_CREDENTIAL2_PROTOCOL.
183 
184   @retval EFI_SUCCESS    Credential provider successfully deselected.
185 **/
186 typedef
187 EFI_STATUS
188 (EFIAPI *EFI_CREDENTIAL2_DESELECT)(
189   IN CONST EFI_USER_CREDENTIAL2_PROTOCOL *This
190   );
191 
192 /**
193   Return the default logon behavior for this user credential.
194 
195   This function reports the default login behavior regarding this credential provider.
196 
197   @param[in]  This               Points to this instance of the EFI_USER_CREDENTIAL2_PROTOCOL.
198   @param[out] AutoLogon          On return, holds whether the credential provider should be
199                                  used by default to automatically log on the user.
200 
201   @retval EFI_SUCCESS            Default information successfully returned.
202   @retval EFI_INVALID_PARAMETER  AutoLogon is NULL.
203 **/
204 typedef
205 EFI_STATUS
206 (EFIAPI *EFI_CREDENTIAL2_DEFAULT)(
207   IN  CONST EFI_USER_CREDENTIAL2_PROTOCOL       *This,
208   OUT EFI_CREDENTIAL_LOGON_FLAGS                *AutoLogon
209   );
210 
211 /**
212   Return information attached to the credential provider.
213 
214   This function returns user information.
215 
216   @param[in]     This           Points to this instance of the EFI_USER_CREDENTIAL2_PROTOCOL.
217   @param[in]     UserInfo       Handle of the user information data record.
218   @param[out]    Info           On entry, points to a buffer of at least *InfoSize bytes. On exit, holds the user
219                                 information. If the buffer is too small to hold the information, then
220                                 EFI_BUFFER_TOO_SMALL is returned and InfoSize is updated to contain the
221                                 number of bytes actually required.
222   @param[in,out] InfoSize       On entry, points to the size of Info. On return, points to the size of the user
223                                 information.
224 
225   @retval EFI_SUCCESS           Information returned successfully.
226   @retval EFI_BUFFER_TOO_SMALL  The size specified by InfoSize is too small to hold all of the user
227                                 information. The size required is returned in *InfoSize.
228   @retval EFI_NOT_FOUND         The specified UserInfo does not refer to a valid user info handle.
229   @retval EFI_INVALID_PARAMETER Info is NULL or InfoSize is NULL.
230 **/
231 typedef
232 EFI_STATUS
233 (EFIAPI *EFI_CREDENTIAL2_GET_INFO)(
234   IN CONST EFI_USER_CREDENTIAL2_PROTOCOL *This,
235   IN       EFI_USER_INFO_HANDLE          UserInfo,
236   OUT      EFI_USER_INFO                 *Info,
237   IN OUT   UINTN                         *InfoSize
238   );
239 
240 /**
241   Enumerate all of the user information records on the credential provider.
242 
243   This function returns the next user information record. To retrieve the first user information record
244   handle, point UserInfo at a NULL. Each subsequent call will retrieve another user information
245   record handle until there are no more, at which point UserInfo will point to NULL.
246 
247   @param[in]     This            Points to this instance of the EFI_USER_CREDENTIAL2_PROTOCOL.
248   @param[in,out] UserInfo        On entry, points to the previous user information handle or NULL to
249                                  start enumeration. On exit, points to the next user information handle
250                                  or NULL if there is no more user information.
251 
252   @retval EFI_SUCCESS            User information returned.
253   @retval EFI_NOT_FOUND          No more user information found.
254   @retval EFI_INVALID_PARAMETER  UserInfo is NULL.
255 **/
256 typedef
257 EFI_STATUS
258 (EFIAPI *EFI_CREDENTIAL2_GET_NEXT_INFO)(
259   IN CONST EFI_USER_CREDENTIAL2_PROTOCOL *This,
260   IN OUT   EFI_USER_INFO_HANDLE          *UserInfo
261   );
262 
263 /**
264   Delete a user on this credential provider.
265 
266   This function deletes a user on this credential provider.
267 
268   @param[in]     This            Points to this instance of the EFI_USER_CREDENTIAL2_PROTOCOL.
269   @param[in]     User            The user profile handle to delete.
270 
271   @retval EFI_SUCCESS            User profile was successfully deleted.
272   @retval EFI_ACCESS_DENIED      Current user profile does not permit deletion on the user profile handle.
273                                  Either the user profile cannot delete on any user profile or cannot delete
274                                  on a user profile other than the current user profile.
275   @retval EFI_UNSUPPORTED        This credential provider does not support deletion in the pre-OS.
276   @retval EFI_DEVICE_ERROR       The new credential could not be deleted because of a device error.
277   @retval EFI_INVALID_PARAMETER  User does not refer to a valid user profile handle.
278 **/
279 typedef
280 EFI_STATUS
281 (EFIAPI *EFI_CREDENTIAL2_DELETE)(
282  IN CONST EFI_USER_CREDENTIAL2_PROTOCOL  *This,
283  IN       EFI_USER_PROFILE_HANDLE        User
284 );
285 
286 ///
287 /// This protocol provides support for a single class of credentials
288 ///
289 struct _EFI_USER_CREDENTIAL2_PROTOCOL {
290   EFI_GUID                      Identifier;  ///< Uniquely identifies this credential provider.
291   EFI_GUID                      Type;        ///< Identifies this class of User Credential Provider.
292   EFI_CREDENTIAL2_ENROLL        Enroll;
293   EFI_CREDENTIAL2_FORM          Form;
294   EFI_CREDENTIAL2_TILE          Tile;
295   EFI_CREDENTIAL2_TITLE         Title;
296   EFI_CREDENTIAL2_USER          User;
297   EFI_CREDENTIAL2_SELECT        Select;
298   EFI_CREDENTIAL2_DESELECT      Deselect;
299   EFI_CREDENTIAL2_DEFAULT       Default;
300   EFI_CREDENTIAL2_GET_INFO      GetInfo;
301   EFI_CREDENTIAL2_GET_NEXT_INFO GetNextInfo;
302   EFI_CREDENTIAL_CAPABILITIES   Capabilities;
303   EFI_CREDENTIAL2_DELETE        Delete;
304 };
305 
306 extern EFI_GUID gEfiUserCredential2ProtocolGuid;
307 
308 #endif
309