Skip to content

Commit

Permalink
chore: migrate to Duende (#115)
Browse files Browse the repository at this point in the history
Co-authored-by: Peter Fern <github@0xc0dedbad.com>

Co-authored-by: Peter Fern <github@0xc0dedbad.com>
  • Loading branch information
AleF83 and pdf authored Jul 14, 2022
1 parent 59bdbe8 commit 23c9878
Show file tree
Hide file tree
Showing 35 changed files with 412 additions and 510 deletions.
87 changes: 43 additions & 44 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"
name: 'CodeQL'

on:
push:
branches: [ master ]
branches: [master]
pull_request:
# The branches below must be a subset of the branches above
branches: [ master ]
branches: [master]
schedule:
- cron: '42 23 * * 3'

Expand All @@ -32,57 +32,56 @@ jobs:
strategy:
fail-fast: false
matrix:
language: [ 'csharp', 'javascript' ]
language: ['csharp', 'javascript']
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
# Learn more:
# https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed

steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Checkout repository
uses: actions/checkout@v2

- name: Setup NodeJS version
uses: actions/setup-node@v2-beta
with:
node-version: '14'
- name: Setup NodeJS version
uses: actions/setup-node@v2-beta
with:
node-version: '14'

- name: Setup dotnet version
uses: actions/setup-dotnet@v1
with:
dotnet-version: '6.0.x'
- name: Setup dotnet version
uses: actions/setup-dotnet@v1
with:
dotnet-version: '6.0.x'

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main

# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
if: ${{ matrix.language == 'javascript' }}
uses: github/codeql-action/autobuild@v1
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
if: ${{ matrix.language == 'javascript' }}
uses: github/codeql-action/autobuild@v1

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language

# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language
- name: CS Build
if: ${{ matrix.language == 'csharp' }}
run: |
curl -L https://raw.githubusercontent.com/DuendeSoftware/IdentityServer.Quickstart.UI/main/getmain.sh | bash
dotnet clean OpenIdConnectServerMock.csproj
dotnet restore OpenIdConnectServerMock.csproj
dotnet build --no-incremental /p:UseSharedCompilation=false OpenIdConnectServerMock.csproj
working-directory: ./src

- name: CS Build
if: ${{ matrix.language == 'csharp' }}
run: |
./getmain.sh
dotnet clean OpenIdConnectServerMock.csproj
dotnet restore OpenIdConnectServerMock.csproj
dotnet build --no-incremental /p:UseSharedCompilation=false OpenIdConnectServerMock.csproj
working-directory: ./src

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
5 changes: 2 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,5 @@ obj
.docker

# UI
Quickstart
Views
wwwroot
src/Pages
src/wwwroot
12 changes: 9 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,11 @@ services:
"CheckSessionCookieSameSiteMode": "Lax"
}
}
ACCOUNT_OPTIONS_INLINE: |
LOGIN_OPTIONS_INLINE: |
{
"AllowRememberLogin": false
}
LOGOUT_OPTIONS_INLINE: |
{
"AutomaticRedirectAfterSignOut": true
}
Expand Down Expand Up @@ -121,7 +125,8 @@ Clients configuration should be provided. Test user configuration is optional (u
There are two ways to provide configuration for supported scopes, clients and users. You can either provide it inline as environment variable:

- `SERVER_OPTIONS_INLINE`
- `ACCOUNT_OPTIONS_INLINE`
- `LOGIN_OPTIONS_INLINE`
- `LOGOUT_OPTIONS_INLINE`
- `API_SCOPES_INLINE`
- `USERS_CONFIGURATION_INLINE`
- `CLIENTS_CONFIGURATION_INLINE`
Expand All @@ -131,7 +136,8 @@ There are two ways to provide configuration for supported scopes, clients and us
or mount volume and provide the path to configuration json as environment variable:

- `SERVER_OPTIONS_PATH`
- `ACCOUNT_OPTIONS_PATH`
- `LOGIN_OPTIONS_PATH`
- `LOGOUT_OPTIONS_PATH`
- `API_SCOPES_PATH`
- `USERS_CONFIGURATION_PATH`
- `CLIENTS_CONFIGURATION_PATH`
Expand Down
3 changes: 0 additions & 3 deletions e2e/config/account-options.json

This file was deleted.

8 changes: 5 additions & 3 deletions e2e/config/clients.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,12 @@
"Claims": [
{
"Type": "string_claim",
"Value": "string_claim_value"
"Value": "string_claim_value",
"ValueType": "string"
},
{
"Type": "json_claim",
"Value": "['value1', 'value2']",
"Value": "[\"value1\", \"value2\"]",
"ValueType": "json"
}
]
Expand All @@ -38,7 +39,8 @@
"Claims": [
{
"Type": "string_claim",
"Value": "string_claim_value"
"Value": "string_claim_value",
"ValueType": "string"
},
{
"Type": "json_claim",
Expand Down
133 changes: 48 additions & 85 deletions e2e/config/users.yaml
Original file line number Diff line number Diff line change
@@ -1,95 +1,58 @@
[
{ 'SubjectId': 'simple_user', 'Username': 'simple_user', 'Password': 'pwd' },
{
"SubjectId": "simple_user",
"Username": "simple_user",
"Password": "pwd"
'SubjectId': 'user_with_standard_claims',
'Username': 'user_with_standard_claims',
'Password': 'pwd',
'Claims':
[
{ 'Type': 'name', 'Value': 'John Smith', 'ValueType': 'string' },
{ 'Type': 'email', 'Value': 'john.smith@gmail.com', 'ValueType': 'emailaddress' },
{ 'Type': 'email_verified', 'Value': 'true', 'ValueType': 'boolean' },
],
},
{
"SubjectId": "user_with_standard_claims",
"Username": "user_with_standard_claims",
"Password": "pwd",
"Claims": [
{
"Type": "name",
"Value": "John Smith"
},
{
"Type": "email",
"Value": "john.smith@gmail.com"
},
{
"Type": "email_verified",
"Value": "true"
}
]
'SubjectId': 'user_with_custom_identity_claims',
'Username': 'user_with_custom_identity_claims',
'Password': 'pwd',
'Claims':
[
{ 'Type': 'name', 'Value': 'Jack Sparrow', 'ValueType': 'string' },
{ 'Type': 'email', 'Value': 'jack.sparrow@gmail.com', 'ValueType': 'emailaddress' },
{ 'Type': 'some-custom-identity-user-claim', 'Value': "Jack's Custom User Claim", 'ValueType': 'string' },
],
},
{
"SubjectId": "user_with_custom_identity_claims",
"Username": "user_with_custom_identity_claims",
"Password": "pwd",
"Claims": [
{
"Type": "name",
"Value": "Jack Sparrow"
},
{
"Type": "email",
"Value": "jack.sparrow@gmail.com"
},
{
"Type": "some-custom-identity-user-claim",
"Value": "Jack's Custom User Claim"
}
]
'SubjectId': 'user_with_custom_api_resource_claims',
'Username': 'user_with_custom_api_resource_claims',
'Password': 'pwd',
'Claims':
[
{ 'Type': 'name', 'Value': 'Sam Tailor', 'ValueType': 'string' },
{ 'Type': 'email', 'Value': 'sam.tailor@gmail.com', 'ValueType': 'emailaddress' },
{ 'Type': 'some-app-user-custom-claim', 'Value': "Sam's Custom User Claim", 'ValueType': 'string' },
{
'Type': 'some-app-scope-1-custom-user-claim',
'Value': "Sam's Scope Custom User Claim",
'ValueType': 'string',
},
],
},
{
"SubjectId": "user_with_custom_api_resource_claims",
"Username": "user_with_custom_api_resource_claims",
"Password": "pwd",
"Claims": [
{
"Type": "name",
"Value": "Sam Tailor"
},
{
"Type": "email",
"Value": "sam.tailor@gmail.com"
},
{
"Type": "some-app-user-custom-claim",
"Value": "Sam's Custom User Claim"
},
{
"Type": "some-app-scope-1-custom-user-claim",
"Value": "Sam's Scope Custom User Claim"
}
]
'SubjectId': 'user_with_all_claim_types',
'Username': 'user_with_all_claim_types',
'Password': 'pwd',
'Claims':
[
{ 'Type': 'name', 'Value': 'Oliver Hunter', 'ValueType': 'string' },
{ 'Type': 'email', 'Value': 'oliver.hunter@gmail.com', 'ValueType': 'emailaddress' },
{ 'Type': 'some-app-user-custom-claim', 'Value': "Oliver's Custom User Claim", 'ValueType': 'string' },
{
'Type': 'some-app-scope-1-custom-user-claim',
'Value': "Oliver's Scope Custom User Claim",
'ValueType': 'string',
},
{ 'Type': 'some-custom-identity-user-claim', 'Value': "Oliver's Custom User Claim", 'ValueType': 'string' },
],
},
{
"SubjectId": "user_with_all_claim_types",
"Username": "user_with_all_claim_types",
"Password": "pwd",
"Claims": [
{
"Type": "name",
"Value": "Oliver Hunter"
},
{
"Type": "email",
"Value": "oliver.hunter@gmail.com"
},
{
"Type": "some-app-user-custom-claim",
"Value": "Oliver's Custom User Claim"
},
{
"Type": "some-app-scope-1-custom-user-claim",
"Value": "Oliver's Scope Custom User Claim"
},
{
"Type": "some-custom-identity-user-claim",
"Value": "Oliver's Custom User Claim"
}
]
}
]
9 changes: 8 additions & 1 deletion e2e/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,14 @@ services:
ASPNETCORE_Kestrel__Certificates__Default__Password: oidc-server-mock-pwd
ASPNETCORE_Kestrel__Certificates__Default__Path: /https/aspnetapp.pfx
SERVER_OPTIONS_PATH: /config/server-options.json
ACCOUNT_OPTIONS_PATH: /config/account-options.json
LOGIN_OPTIONS_INLINE: |
{
"AllowRememberLogin": false
}
LOGOUT_OPTIONS_INLINE: |
{
"AutomaticRedirectAfterSignOut": true
}
API_RESOURCES_PATH: /config/api-resources.yaml
API_SCOPES_INLINE: |
- Name: some-app-scope-1
Expand Down
6 changes: 3 additions & 3 deletions e2e/helpers/authorization-endpoint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ export default async (page: Page, parameters: URLSearchParams, user: User, redir
const response = await page.goto(url);
expect(response.ok()).toBeTruthy();

await page.waitForSelector('#Username');
await page.type('#Username', user.Username);
await page.type('#Password', user.Password);
await page.waitForSelector('[id=Input_Username]');
await page.type('[id=Input_Username]', user.Username);
await page.type('[id=Input_Password]', user.Password);
await page.keyboard.press('Enter');
await page.waitForNavigation();
const redirectedUrl = new URL(page.url());
Expand Down
6 changes: 3 additions & 3 deletions e2e/helpers/grants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ export default async (page: Page, user: User): Promise<void> => {
const response = await page.goto(process.env.OIDC_GRANTS_URL);
expect(response.ok()).toBeTruthy();

await page.waitForSelector('#Username');
await page.type('#Username', user.Username);
await page.type('#Password', user.Password);
await page.waitForSelector('[id=Input_Username]');
await page.type('[id=Input_Username]', user.Username);
await page.type('[id=Input_Password]', user.Password);
await page.keyboard.press('Enter');
await page.waitForNavigation();
expect(await page.content()).toMatchSnapshot();
Expand Down
Loading

0 comments on commit 23c9878

Please sign in to comment.