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