From 0b781568fc48c89abd42ddd53cd912de82d5cb4d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fredrik=20H=C3=B8is=C3=A6ther=20Rasch?=
 <fredrik.rasch@gmail.com>
Date: Sun, 28 Jan 2024 22:07:04 +0100
Subject: [PATCH] Add test workflow for testing MSAL Authentication

---
 .../workflows/msidp-authentication-test.yml   | 71 +++++++++++++++++++
 1 file changed, 71 insertions(+)
 create mode 100644 .github/workflows/msidp-authentication-test.yml

diff --git a/.github/workflows/msidp-authentication-test.yml b/.github/workflows/msidp-authentication-test.yml
new file mode 100644
index 0000000..5f64693
--- /dev/null
+++ b/.github/workflows/msidp-authentication-test.yml
@@ -0,0 +1,71 @@
+name: MSAL Federated Credentials
+
+on:
+  workflow_dispatch:
+    inputs:
+      tenant-id:
+        type: string
+        required: true
+      client-id:
+        type: string
+        required: true
+      resource:
+        type: string
+      resource-hostname:
+        type: string
+
+permissions:
+  id-token: write
+
+jobs:
+  msal:
+    name: Acquire Azure AD Access Token
+    runs-on: ubuntu-latest
+    steps:
+      - name: Checkout ${{ github.repository }}@${{ github.ref }}
+        uses: actions/checkout@v4.1.1
+      - name: Authenticate using GitHub action
+        uses: ./run/ms-idp-workflow-run-auth
+        with:
+          tenant-id: ${{ inputs.tenant-id }}
+          client-id: ${{ inputs.client-id }}
+          resource: ${{ inputs.resource }}
+  msal-tmp-cert:
+    name: Acquire Azure AD Access Token (using temporary certificate)
+    runs-on: ubuntu-latest
+    steps:
+      - name: Checkout ${{ github.repository }}@${{ github.ref }}
+        uses: actions/checkout@v4.1.1
+      - name: Authenticate using GitHub action
+        uses: ./run/ms-idp-workflow-run-auth
+        with:
+          tenant-id: ${{ inputs.tenant-id }}
+          client-id: ${{ inputs.client-id }}
+          resource: ${{ inputs.resource }}
+          auth-method: 'ms-idp-temporary-certificate'
+  msal-tmp-secret:
+    name: Acquire Azure AD Access Token (using temporary secret)
+    runs-on: ubuntu-latest
+    steps:
+      - name: Checkout ${{ github.repository }}@${{ github.ref }}
+        uses: actions/checkout@v4.1.1
+      - name: Authenticate using GitHub action
+        uses: ./run/ms-idp-workflow-run-auth
+        with:
+          tenant-id: ${{ inputs.tenant-id }}
+          client-id: ${{ inputs.client-id }}
+          resource: ${{ inputs.resource }}
+          auth-method: 'ms-idp-temporary-secret'
+  acs-tmp-secret:
+    name: Acquire Azure AD Access Token (using ACS with temporary secret)
+    runs-on: ubuntu-latest
+    steps:
+      - name: Checkout ${{ github.repository }}@${{ github.ref }}
+        uses: actions/checkout@v4.1.1
+      - name: Authenticate using GitHub action
+        uses: ./run/ms-idp-workflow-run-auth
+        with:
+          tenant-id: ${{ inputs.tenant-id }}
+          client-id: ${{ inputs.client-id }}
+          resource: ${{ inputs.resource }}/${{ inputs.resource-hostname }}
+          auth-method: 'az-acs-temporary-secret'