EdkIIRedfishCredential.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. /** @file
  2. This file defines the EDKII_REDFISH_CREDENTIAL_PROTOCOL interface.
  3. Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
  4. (C) Copyright 2020 Hewlett Packard Enterprise Development LP<BR>
  5. SPDX-License-Identifier: BSD-2-Clause-Patent
  6. **/
  7. #ifndef EDKII_REDFISH_CREDENTIAL_H_
  8. #define EDKII_REDFISH_CREDENTIAL_H_
  9. typedef struct _EDKII_REDFISH_CREDENTIAL_PROTOCOL EDKII_REDFISH_CREDENTIAL_PROTOCOL;
  10. #define EDKII_REDFISH_CREDENTIAL_PROTOCOL_GUID \
  11. { \
  12. 0x8804377, 0xaf7a, 0x4496, { 0x8a, 0x7b, 0x17, 0x59, 0x0, 0xe9, 0xab, 0x46 } \
  13. }
  14. typedef enum {
  15. AuthMethodNone, ///< No authentication is required.
  16. AuthMethodHttpBasic, ///< Basic authentication is required.
  17. AuthMethodRedfishSession, ///< Session authentication is required.
  18. AuthMethodMax
  19. } EDKII_REDFISH_AUTH_METHOD;
  20. typedef enum {
  21. ServiceStopTypeNone = 0, ///< Stop Redfsih service without reason.
  22. ServiceStopTypeSecureBootDisabled, ///< Stop Redfsih service becasue EFI
  23. ///< Secure Boot is disabled.
  24. ServiceStopTypeExitBootService, ///< Stop Redfsih service becasue existing
  25. ///< Boot Service.
  26. ServiceStopTypeMax
  27. } EDKII_REDFISH_CREDENTIAL_STOP_SERVICE_TYPE;
  28. /**
  29. Retrieve platform's Redfish authentication information.
  30. This functions returns the Redfish authentication method together with the user Id and
  31. password.
  32. - For AuthMethodNone, the UserId and Password could be used for HTTP header authentication
  33. as defined by RFC7235.
  34. - For AuthMethodRedfishSession, the UserId and Password could be used for Redfish
  35. session login as defined by Redfish API specification (DSP0266).
  36. Callers are responsible for and freeing the returned string storage.
  37. @param[in] This Pointer to EDKII_REDFISH_CREDENTIAL_PROTOCOL instance.
  38. @param[out] AuthMethod Type of Redfish authentication method.
  39. @param[out] UserId The pointer to store the returned UserId string.
  40. @param[out] Password The pointer to store the returned Password string.
  41. @retval EFI_SUCCESS Get the authentication information successfully.
  42. @retval EFI_ACCESS_DENIED SecureBoot is disabled after EndOfDxe.
  43. @retval EFI_INVALID_PARAMETER This or AuthMethod or UserId or Password is NULL.
  44. @retval EFI_OUT_OF_RESOURCES There are not enough memory resources.
  45. @retval EFI_UNSUPPORTED Unsupported authentication method is found.
  46. **/
  47. typedef
  48. EFI_STATUS
  49. (EFIAPI *EDKII_REDFISH_CREDENTIAL_PROTOCOL_GET_AUTH_INFO)(
  50. IN EDKII_REDFISH_CREDENTIAL_PROTOCOL *This,
  51. OUT EDKII_REDFISH_AUTH_METHOD *AuthMethod,
  52. OUT CHAR8 **UserId,
  53. OUT CHAR8 **Password
  54. );
  55. /**
  56. Notify the Redfish service provide to stop provide configuration service to this platform.
  57. This function should be called when the platfrom is about to leave the safe environment.
  58. It will notify the Redfish service provider to abort all logined session, and prohibit
  59. further login with original auth info. GetAuthInfo() will return EFI_UNSUPPORTED once this
  60. function is returned.
  61. @param[in] This Pointer to EDKII_REDFISH_CREDENTIAL_PROTOCOL instance.
  62. @param[in] ServiceStopType Reason of stopping Redfish service.
  63. @retval EFI_SUCCESS Service has been stoped successfully.
  64. @retval EFI_INVALID_PARAMETER This is NULL.
  65. @retval Others Some error happened.
  66. **/
  67. typedef
  68. EFI_STATUS
  69. (EFIAPI *EDKII_REDFISH_CREDENTIAL_PROTOCOL_STOP_SERVICE)(
  70. IN EDKII_REDFISH_CREDENTIAL_PROTOCOL *This,
  71. IN EDKII_REDFISH_CREDENTIAL_STOP_SERVICE_TYPE ServiceStopType
  72. );
  73. struct _EDKII_REDFISH_CREDENTIAL_PROTOCOL {
  74. EDKII_REDFISH_CREDENTIAL_PROTOCOL_GET_AUTH_INFO GetAuthInfo;
  75. EDKII_REDFISH_CREDENTIAL_PROTOCOL_STOP_SERVICE StopService;
  76. };
  77. extern EFI_GUID gEdkIIRedfishCredentialProtocolGuid;
  78. #endif