public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Abner Chang" <abner.chang@hpe.com>
To: devel@edk2.groups.io
Cc: Nickle Wang <nickle.wang@hpe.com>,
	Peter O'Hanley <peter.ohanley@hpe.com>
Subject: [PATCH 1/2] RedfishPkg/Include: EDKII Redfish Credential Header file
Date: Wed,  9 Dec 2020 16:43:32 +0800	[thread overview]
Message-ID: <20201209084333.22422-2-abner.chang@hpe.com> (raw)
In-Reply-To: <20201209084333.22422-1-abner.chang@hpe.com>

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>
---
 .../Include/Protocol/EdkIIRedfishCredential.h | 101 ++++++++++++++++++
 RedfishPkg/RedfishPkg.dec                     |   3 +
 2 files changed, 104 insertions(+)
 create mode 100644 RedfishPkg/Include/Protocol/EdkIIRedfishCredential.h

diff --git a/RedfishPkg/Include/Protocol/EdkIIRedfishCredential.h b/RedfishPkg/Include/Protocol/EdkIIRedfishCredential.h
new file mode 100644
index 0000000000..34e33b1e00
--- /dev/null
+++ b/RedfishPkg/Include/Protocol/EdkIIRedfishCredential.h
@@ -0,0 +1,101 @@
+/** @file
+  This file defines the EDKII_REDFISH_CREDENTIAL_PROTOCOL interface.
+
+  Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+  (C) Copyright 2020 Hewlett Packard Enterprise Development LP<BR>
+
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef EDKII_REDFISH_CREDENTIAL_H_
+#define EDKII_REDFISH_CREDENTIAL_H_
+
+typedef struct _EDKII_REDFISH_CREDENTIAL_PROTOCOL EDKII_REDFISH_CREDENTIAL_PROTOCOL;
+
+#define EDKII_REDFISH_CREDENTIAL_PROTOCOL_GUID \
+    {  \
+      0x8804377, 0xaf7a, 0x4496, { 0x8a, 0x7b, 0x17, 0x59, 0x0, 0xe9, 0xab, 0x46 }  \
+    }
+
+typedef enum {
+  AuthMethodNone,            ///< No authentication is required.
+  AuthMethodHttpBasic,       ///< Basic authentication is required.
+  AuthMethodRedfishSession,  ///< Session authentication is required.
+  AuthMethodMax
+} EDKII_REDFISH_AUTH_METHOD;
+
+typedef enum {
+  ServiceStopTypeNone = 0,            ///< Stop Redfsih service without reason.
+  ServiceStopTypeSecureBootDisabled,  ///< Stop Redfsih service becasue EFI
+                                      ///< Secure Boot is disabled.
+  ServiceStopTypeExitBootService,     ///< Stop Redfsih service becasue existing
+                                      ///< Boot Service.
+  ServiceStopTypeMax
+} EDKII_REDFISH_CREDENTIAL_STOP_SERVICE_TYPE;
+
+
+/**
+  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.
+
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EDKII_REDFISH_CREDENTIAL_PROTOCOL_GET_AUTH_INFO) (
+  IN  EDKII_REDFISH_CREDENTIAL_PROTOCOL    *This,
+  OUT EDKII_REDFISH_AUTH_METHOD            *AuthMethod,
+  OUT CHAR8                                **UserId,
+  OUT CHAR8                                **Password
+  );
+
+/**
+  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.
+  @retval Others                   Some error happened.
+
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EDKII_REDFISH_CREDENTIAL_PROTOCOL_STOP_SERVICE) (
+  IN     EDKII_REDFISH_CREDENTIAL_PROTOCOL            *This,
+  IN     EDKII_REDFISH_CREDENTIAL_STOP_SERVICE_TYPE   ServiceStopType
+  );
+
+struct _EDKII_REDFISH_CREDENTIAL_PROTOCOL {
+  EDKII_REDFISH_CREDENTIAL_PROTOCOL_GET_AUTH_INFO      GetAuthInfo;
+  EDKII_REDFISH_CREDENTIAL_PROTOCOL_STOP_SERVICE       StopService;
+};
+
+extern EFI_GUID gEdkIIRedfishCredentialProtocolGuid;
+
+#endif
diff --git a/RedfishPkg/RedfishPkg.dec b/RedfishPkg/RedfishPkg.dec
index b38e9b4789..861f6dd0c8 100644
--- a/RedfishPkg/RedfishPkg.dec
+++ b/RedfishPkg/RedfishPkg.dec
@@ -25,6 +25,9 @@
   ## Include/Protocol/RedfishDiscover.h
   gEfiRedfishDiscoverProtocolGuid      = { 0x5db12509, 0x4550, 0x4347, { 0x96, 0xb3, 0x73, 0xc0, 0xff, 0x6e, 0x86, 0x9f }}
 
+  ## Include/Protocol/EdkIIRedfishCredential.h
+  gEdkIIRedfishCredentialProtocolGuid = { 0x8804377, 0xaf7a, 0x4496, { 0x8a, 0x7b, 0x17, 0x59, 0x0, 0xe9, 0xab, 0x46 } }
+
 [Guids]
   gEfiRedfishPkgTokenSpaceGuid      = { 0x4fdbccb7, 0xe829, 0x4b4c, { 0x88, 0x87, 0xb2, 0x3f, 0xd7, 0x25, 0x4b, 0x85 }}
 
-- 
2.17.1


  reply	other threads:[~2020-12-09  9:30 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-09  8:43 [PATCH 0/2] EDKII Redfish Credential DXE Driver Abner Chang
2020-12-09  8:43 ` Abner Chang [this message]
2020-12-10  2:44   ` [PATCH 1/2] RedfishPkg/Include: EDKII Redfish Credential Header file Nickle Wang
2020-12-16  2:37   ` Nickle Wang
2020-12-09  8:43 ` [PATCH 2/2] RedfishPkg/RedfishCredentialDxe: EDKII Redfish Credential DXE driver Abner Chang
2020-12-10  2:00   ` 回复: [edk2-devel] " gaoliming
2020-12-10  2:12     ` Abner Chang
2020-12-16  2:45   ` Nickle Wang
2020-12-16  7:08     ` Abner Chang
2020-12-16  7:27       ` Abner Chang
2020-12-16  7:37         ` Nickle Wang
2020-12-16  7:43           ` Abner Chang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201209084333.22422-2-abner.chang@hpe.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox