2 The header file for User identify Manager driver.
4 Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>
5 This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
15 #ifndef _USER_IDENTIFY_MANAGER_H_
16 #define _USER_IDENTIFY_MANAGER_H_
20 #include <Guid/GlobalVariable.h>
21 #include <Guid/MdeModuleHii.h>
23 #include <Protocol/FormBrowser2.h>
24 #include <Protocol/HiiDatabase.h>
25 #include <Protocol/HiiConfigAccess.h>
26 #include <Protocol/HiiString.h>
27 #include <Protocol/HiiConfigRouting.h>
28 #include <Protocol/UserCredential2.h>
29 #include <Protocol/UserManager.h>
30 #include <Protocol/DeferredImageLoad.h>
31 #include <Protocol/SimpleTextOut.h>
32 #include <Protocol/SimpleTextIn.h>
33 #include <Protocol/SimpleTextInEx.h>
35 #include <Library/UefiRuntimeServicesTableLib.h>
36 #include <Library/UefiBootServicesTableLib.h>
37 #include <Library/MemoryAllocationLib.h>
38 #include <Library/BaseMemoryLib.h>
39 #include <Library/DevicePathLib.h>
40 #include <Library/DebugLib.h>
41 #include <Library/UefiLib.h>
42 #include <Library/PrintLib.h>
43 #include <Library/HiiLib.h>
45 #include "UserIdentifyManagerData.h"
48 // This is the generated IFR binary data for each formset defined in VFR.
49 // This data array is ready to be used as input of HiiAddPackages() to
50 // create a packagelist.
52 extern UINT8 UserIdentifyManagerVfrBin
[];
55 // This is the generated String package data for all .UNI files.
56 // This data array is ready to be used as input of HiiAddPackages() to
57 // create a packagelist.
59 extern UINT8 UserIdentifyManagerStrings
[];
61 #define USER_NUMBER_INC 32
62 #define DEFAULT_PROFILE_SIZE 512
63 #define INFO_PAYLOAD_SIZE 64
66 // Credential Provider Information.
70 EFI_USER_CREDENTIAL2_PROTOCOL
*Provider
[1];
71 } CREDENTIAL_PROVIDER_INFO
;
74 // Internal user profile entry.
78 UINTN UserProfileSize
;
79 CHAR16 UserVarName
[9];
84 // Internal user profile database.
89 EFI_USER_PROFILE_HANDLE UserProfile
[1];
92 #define USER_MANAGER_SIGNATURE SIGNATURE_32 ('U', 'I', 'M', 'S')
96 EFI_HANDLE DriverHandle
;
97 EFI_HII_HANDLE HiiHandle
;
100 // Consumed protocol.
102 EFI_HII_DATABASE_PROTOCOL
*HiiDatabase
;
103 EFI_HII_STRING_PROTOCOL
*HiiString
;
104 EFI_HII_CONFIG_ROUTING_PROTOCOL
*HiiConfigRouting
;
105 EFI_FORM_BROWSER2_PROTOCOL
*FormBrowser2
;
108 // Produced protocol.
110 EFI_HII_CONFIG_ACCESS_PROTOCOL ConfigAccess
;
111 } USER_MANAGER_CALLBACK_INFO
;
114 /// HII specific Vendor Device Path definition.
117 VENDOR_DEVICE_PATH VendorDevicePath
;
118 EFI_DEVICE_PATH_PROTOCOL End
;
119 } HII_VENDOR_DEVICE_PATH
;
122 Register an event notification function for the user profile changed.
124 @param[in] ImageHandle Image handle this driver.
128 LoadDeferredImageInit (
129 IN EFI_HANDLE ImageHandle
134 This function creates a new user profile with only
135 a new user identifier attached and returns its handle.
136 The user profile is non-volatile, but the handle User
137 can change across reboots.
139 @param[in] This Protocol EFI_USER_MANAGER_PROTOCOL instance
141 @param[out] User Handle of a new user profile.
143 @retval EFI_SUCCESS User profile was successfully created.
144 @retval EFI_ACCESS_DENIED Current user does not have sufficient permissions
145 to create a user profile.
146 @retval EFI_UNSUPPORTED Creation of new user profiles is not supported.
147 @retval EFI_INVALID_PARAMETER User is NULL.
153 IN CONST EFI_USER_MANAGER_PROTOCOL
*This
,
154 OUT EFI_USER_PROFILE_HANDLE
*User
159 Delete an existing user profile.
161 @param This Protocol EFI_USER_MANAGER_PROTOCOL instance
163 @param User User profile handle.
165 @retval EFI_SUCCESS User profile was successfully deleted.
166 @retval EFI_ACCESS_DENIED Current user does not have sufficient permissions
167 to delete a user profile or there is only one
169 @retval EFI_UNSUPPORTED Deletion of new user profiles is not supported.
170 @retval EFI_INVALID_PARAMETER User does not refer to a valid user profile.
176 IN CONST EFI_USER_MANAGER_PROTOCOL
*This
,
177 IN EFI_USER_PROFILE_HANDLE User
182 Get next user profile from the user profile database.
184 @param[in] This Protocol EFI_USER_MANAGER_PROTOCOL instance
186 @param[in, out] User User profile handle.
188 @retval EFI_SUCCESS Next enrolled user profile successfully returned.
189 @retval EFI_INVALID_PARAMETER User is NULL.
195 IN CONST EFI_USER_MANAGER_PROTOCOL
*This
,
196 IN OUT EFI_USER_PROFILE_HANDLE
*User
201 This function returns the current user profile handle.
203 @param[in] This Protocol EFI_USER_MANAGER_PROTOCOL instance pointer.
204 @param[out] CurrentUser User profile handle.
206 @retval EFI_SUCCESS Current user profile handle returned successfully.
207 @retval EFI_INVALID_PARAMETER CurrentUser is NULL.
213 IN CONST EFI_USER_MANAGER_PROTOCOL
*This
,
214 OUT EFI_USER_PROFILE_HANDLE
*CurrentUser
219 Identify the user and, if authenticated, returns the user handle and changes
220 the current user profile.
222 @param This Protocol EFI_USER_MANAGER_PROTOCOL instance pointer.
223 @param CurrentUser User profile handle.
225 @retval EFI_SUCCESS User was successfully identified.
226 @retval EFI_INVALID_PARAMETER User is NULL.
227 @retval EFI_ACCESS_DENIED User was not successfully identified.
232 UserProfileIdentify (
233 IN CONST EFI_USER_MANAGER_PROTOCOL
*This
,
234 OUT EFI_USER_PROFILE_HANDLE
*User
239 Find a user using a user information record.
241 This function searches all user profiles for the specified user information record.
242 The search starts with the user information record handle following UserInfo and
243 continues until either the information is found or there are no more user profiles.
244 A match occurs when the Info.InfoType field matches the user information record
245 type and the user information record data matches the portion of Info passed the
246 EFI_USER_INFO header.
248 @param[in] This Points to this instance of the EFI_USER_MANAGER_PROTOCOL.
249 @param[in, out] User On entry, points to the previously returned user profile
250 handle, or NULL to start searching with the first user profile.
251 On return, points to the user profile handle, or NULL if not
253 @param[in, out] UserInfo On entry, points to the previously returned user information
254 handle, or NULL to start searching with the first. On return,
255 points to the user information handle of the user information
256 record, or NULL if not found. Can be NULL, in which case only
257 one user information record per user can be returned.
258 @param[in] Info Points to the buffer containing the user information to be
259 compared to the user information record. If NULL, then only
260 the user information record type is compared. If InfoSize is 0,
261 then the user information record must be empty.
263 @param[in] InfoSize The size of Info, in bytes.
265 @retval EFI_SUCCESS User information was found. User points to the user profile handle,
266 and UserInfo points to the user information handle.
267 @retval EFI_NOT_FOUND User information was not found. User points to NULL and UserInfo
274 IN CONST EFI_USER_MANAGER_PROTOCOL
*This
,
275 IN OUT EFI_USER_PROFILE_HANDLE
*User
,
276 IN OUT EFI_USER_INFO_HANDLE
*UserInfo OPTIONAL
,
277 IN CONST EFI_USER_INFO
*Info
,
283 This function returns user information.
285 @param This Protocol EFI_USER_MANAGER_PROTOCOL instance
287 @param User Handle of the user whose profile will be
289 @param UserInfo Handle of the user information data record.
290 @param Info On entry, points to a buffer of at least
291 *InfoSize bytes. On exit, holds the user
293 @param InfoSize On entry, points to the size of Info. On return,
294 points to the size of the user information.
296 @retval EFI_SUCCESS Information returned successfully.
297 @retval EFI_ACCESS_DENIED The information about the specified user cannot
298 be accessed by the current user.
299 EFI_BUFFER_TOO_SMALL- The number of bytes
300 specified by *InfoSize is too small to hold the
307 IN CONST EFI_USER_MANAGER_PROTOCOL
*This
,
308 IN EFI_USER_PROFILE_HANDLE User
,
309 IN EFI_USER_INFO_HANDLE UserInfo
,
310 OUT EFI_USER_INFO
*Info
,
311 IN OUT UINTN
*InfoSize
316 This function changes user information.
318 @param This Protocol EFI_USER_MANAGER_PROTOCOL instance
320 @param User Handle of the user whose profile will be
322 @param UserInfo Handle of the user information data record.
323 @param Info Points to the user information.
324 @param InfoSize The size of Info, in bytes.
326 @retval EFI_SUCCESS User profile information was successfully
328 @retval EFI_ACCESS_DENIED The record is exclusive.
329 @retval EFI_SECURITY_VIOLATION The current user does not have permission to
330 change the specified user profile or user
337 IN CONST EFI_USER_MANAGER_PROTOCOL
*This
,
338 IN EFI_USER_PROFILE_HANDLE User
,
339 IN OUT EFI_USER_INFO_HANDLE
*UserInfo
,
340 IN CONST EFI_USER_INFO
*Info
,
346 This function allows the credential provider to notify the User Identity Manager
347 when user status has changed while deselected.
349 @param This Protocol EFI_USER_MANAGER_PROTOCOL instance
351 @param Changed Points to the instance of the
352 EFI_USER_CREDENTIAL_PROTOCOL where the user has
355 @retval EFI_SUCCESS The User Identity Manager has handled the
357 @retval EFI_NOT_READY The function was called while the specified
358 credential provider was not selected.
359 @retval EFI_UNSUPPORTED The User Identity Manager doesn't support
360 asynchronous notifications.
366 IN CONST EFI_USER_MANAGER_PROTOCOL
*This
,
367 IN EFI_HANDLE Changed
372 Delete the user information attached to the user profile specified by the UserInfo.
374 @param This Protocol EFI_USER_MANAGER_PROTOCOL instance pointer.
375 @param User Handle of the user whose profile will be retrieved.
376 @param UserInfo Handle of the user information data record.
378 @retval EFI_SUCCESS User information deleted successfully.
379 @retval EFI_ACCESS_DENIED The current user does not have permission to
380 delete this user in-formation.
381 @retval EFI_NOT_FOUND User information record UserInfo does not exist
382 in the user pro-file.
387 UserProfileDeleteInfo (
388 IN CONST EFI_USER_MANAGER_PROTOCOL
*This
,
389 IN EFI_USER_PROFILE_HANDLE User
,
390 IN EFI_USER_INFO_HANDLE UserInfo
395 This function returns the next user information record.
397 @param This Protocol EFI_USER_MANAGER_PROTOCOL instance pointer.
398 @param User Handle of the user whose profile will be retrieved.
399 @param UserInfo Handle of the user information data record.
401 @retval EFI_SUCCESS User information returned.
402 @retval EFI_NOT_FOUND No more user information found.
407 UserProfileGetNextInfo (
408 IN CONST EFI_USER_MANAGER_PROTOCOL
*This
,
409 IN EFI_USER_PROFILE_HANDLE User
,
410 IN OUT EFI_USER_INFO_HANDLE
*UserInfo