summaryrefslogtreecommitdiffstats
path: root/RedfishPkg/Library
diff options
context:
space:
mode:
authorAbner Chang <abner.chang@hpe.com>2020-12-09 12:20:27 +0800
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2020-12-16 08:24:26 +0000
commite6ae24e1d676bb2bdc0fc715b49b04908f41fc10 (patch)
tree5d245ebc85ad486adc8b9d546c761cc923a9cda8 /RedfishPkg/Library
parent2255a2b107349cefec1b585805f444f1e3438689 (diff)
downloadedk2-e6ae24e1d676bb2bdc0fc715b49b04908f41fc10.tar.gz
edk2-e6ae24e1d676bb2bdc0fc715b49b04908f41fc10.tar.bz2
edk2-e6ae24e1d676bb2bdc0fc715b49b04908f41fc10.zip
RedfishPkg/RedfishCredentialDxe: EDKII Redfish Credential DXE driver
EDKII Redfish Credential DXE driver which abstracts platform Redfish credential implementation. Signed-off-by: Jiaxin Wu <jiaxin.wu@intel.com> Signed-off-by: Ting Ye <ting.ye@intel.com> Signed-off-by: Siyuan Fu <siyuan.fu@intel.com> Signed-off-by: Fan Wang <fan.wang@intel.com> Signed-off-by: Abner Chang <abner.chang@hpe.com> Cc: Nickle Wang <nickle.wang@hpe.com> Cc: Peter O'Hanley <peter.ohanley@hpe.com> Reviewed-by: Nickle Wang <nickle.wang@hpe.com>
Diffstat (limited to 'RedfishPkg/Library')
-rw-r--r--RedfishPkg/Library/PlatformCredentialLibNull/PlatformCredentialLibNull.c101
-rw-r--r--RedfishPkg/Library/PlatformCredentialLibNull/PlatformCredentialLibNull.inf30
2 files changed, 131 insertions, 0 deletions
diff --git a/RedfishPkg/Library/PlatformCredentialLibNull/PlatformCredentialLibNull.c b/RedfishPkg/Library/PlatformCredentialLibNull/PlatformCredentialLibNull.c
new file mode 100644
index 0000000000..39de622d59
--- /dev/null
+++ b/RedfishPkg/Library/PlatformCredentialLibNull/PlatformCredentialLibNull.c
@@ -0,0 +1,101 @@
+/** @file
+ NULL instace of RedfishPlatformCredentialLib
+
+ (C) Copyright 2020 Hewlett Packard Enterprise Development LP<BR>
+
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+#include <Uefi.h>
+#include <Protocol/EdkIIRedfishCredential.h>
+/**
+ Notification of Exit Boot Service.
+
+ @param[in] This Pointer to EDKII_REDFISH_CREDENTIAL_PROTOCOL.
+**/
+VOID
+EFIAPI
+LibCredentialExitBootServicesNotify (
+ IN EDKII_REDFISH_CREDENTIAL_PROTOCOL *This
+)
+{
+ return;
+}
+
+/**
+ Notification of End of DXe.
+
+ @param[in] This Pointer to EDKII_REDFISH_CREDENTIAL_PROTOCOL.
+**/
+VOID
+EFIAPI
+LibCredentialEndOfDxeNotify (
+ IN EDKII_REDFISH_CREDENTIAL_PROTOCOL *This
+)
+{
+ return;
+}
+
+/**
+ Retrieve platform's Redfish authentication information.
+
+ This functions returns the Redfish authentication method together with the user Id and
+ password.
+ - For AuthMethodNone, the UserId and Password could be used for HTTP header authentication
+ as defined by RFC7235.
+ - For AuthMethodRedfishSession, the UserId and Password could be used for Redfish
+ session login as defined by Redfish API specification (DSP0266).
+
+ Callers are responsible for and freeing the returned string storage.
+
+ @param[in] This Pointer to EDKII_REDFISH_CREDENTIAL_PROTOCOL instance.
+ @param[out] AuthMethod Type of Redfish authentication method.
+ @param[out] UserId The pointer to store the returned UserId string.
+ @param[out] Password The pointer to store the returned Password string.
+
+ @retval EFI_SUCCESS Get the authentication information successfully.
+ @retval EFI_ACCESS_DENIED SecureBoot is disabled after EndOfDxe.
+ @retval EFI_INVALID_PARAMETER This or AuthMethod or UserId or Password is NULL.
+ @retval EFI_OUT_OF_RESOURCES There are not enough memory resources.
+ @retval EFI_UNSUPPORTED Unsupported authentication method is found.
+
+**/
+EFI_STATUS
+EFIAPI
+LibCredentialGetAuthInfo (
+ IN EDKII_REDFISH_CREDENTIAL_PROTOCOL *This,
+ OUT EDKII_REDFISH_AUTH_METHOD *AuthMethod,
+ OUT CHAR8 **UserId,
+ OUT CHAR8 **Password
+)
+{
+ return EFI_UNSUPPORTED;
+}
+
+/**
+ Notify the Redfish service provide to stop provide configuration service to this platform.
+
+ This function should be called when the platfrom is about to leave the safe environment.
+ It will notify the Redfish service provider to abort all logined session, and prohibit
+ further login with original auth info. GetAuthInfo() will return EFI_UNSUPPORTED once this
+ function is returned.
+
+ @param[in] This Pointer to EDKII_REDFISH_CREDENTIAL_PROTOCOL instance.
+ @param[in] ServiceStopType Reason of stopping Redfish service.
+
+ @retval EFI_SUCCESS Service has been stoped successfully.
+ @retval EFI_INVALID_PARAMETER This is NULL or given the worng ServiceStopType.
+ @retval EFI_UNSUPPORTED Not support to stop Redfish service.
+ @retval Others Some error happened.
+
+**/
+EFI_STATUS
+EFIAPI
+LibStopRedfishService (
+ IN EDKII_REDFISH_CREDENTIAL_PROTOCOL *This,
+ IN EDKII_REDFISH_CREDENTIAL_STOP_SERVICE_TYPE ServiceStopType
+ )
+{
+ return EFI_UNSUPPORTED;
+}
+
diff --git a/RedfishPkg/Library/PlatformCredentialLibNull/PlatformCredentialLibNull.inf b/RedfishPkg/Library/PlatformCredentialLibNull/PlatformCredentialLibNull.inf
new file mode 100644
index 0000000000..4c22e89718
--- /dev/null
+++ b/RedfishPkg/Library/PlatformCredentialLibNull/PlatformCredentialLibNull.inf
@@ -0,0 +1,30 @@
+## @file
+# NULL instance of RedfishPlatformCredentialLib
+#
+# (C) Copyright 2020 Hewlett Packard Enterprise Development LP<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
+
+[Defines]
+ INF_VERSION = 0x0001000b
+ BASE_NAME = RedfishPlatformCredentialLibNull
+ FILE_GUID = CA3BD843-0BDD-4EE0-A38A-B45CA663114F
+ MODULE_TYPE = DXE_DRIVER
+ VERSION_STRING = 1.0
+ LIBRARY_CLASS = RedfishPlatformCredentialLib
+
+#
+# VALID_ARCHITECTURES = IA32 X64 ARM AARCH64 RISCV64
+#
+
+[Sources]
+ PlatformCredentialLibNull.c
+
+[Packages]
+ MdePkg/MdePkg.dec
+ MdeModulePkg/MdeModulePkg.dec
+ RedfishPkg/RedfishPkg.dec
+
+