-
Notifications
You must be signed in to change notification settings - Fork 359
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'dh/import-templates' into public/main
# Conflicts: # LICENSE # identity-server/hosts/AspNetIdentity/wwwroot/lib/bootstrap4-glyphicons/LICENSE # templates/.gitignore # templates/src/IdentityServerAspNetIdentity/wwwroot/lib/bootstrap4-glyphicons/LICENSE
- Loading branch information
Showing
463 changed files
with
182,518 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
name: "CI" | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
- features/** | ||
tags: | ||
- '*.*.*' | ||
pull_request: | ||
|
||
env: | ||
DOTNET_NOLOGO: true | ||
|
||
jobs: | ||
build: | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
runs-on: [windows-latest] | ||
name: ${{ matrix.runs-on }} | ||
runs-on: ${{ matrix.runs-on }} | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Setup dotnet (main) | ||
uses: actions/setup-dotnet@v4 | ||
with: | ||
dotnet-version: '8.0.x' | ||
|
||
- run: dotnet --info | ||
|
||
- if: (matrix.runs-on == 'windows-latest') && (github.ref == 'refs/heads/main' || contains(github.ref, 'refs/tags/')) | ||
env: | ||
SignClientSecret: ${{ secrets.SIGNCLIENTSECRET }} | ||
run: | | ||
./build.ps1 | ||
dotnet nuget push .\artifacts\*.nupkg -s https://www.myget.org/F/duende_identityserver/api/v2/package -k ${{ secrets.MYGET }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
# For most projects, this workflow file will not need changing; you simply need | ||
# to commit it to your repository. | ||
# | ||
# You may wish to alter this file to override the set of languages analyzed, | ||
# or to provide custom queries or build logic. | ||
# | ||
# ******** NOTE ******** | ||
# We have attempted to detect the languages in your repository. Please check | ||
# the `language` matrix defined below to confirm you have the correct set of | ||
# supported CodeQL languages. | ||
# | ||
name: "CodeQL" | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
pull_request: | ||
# The branches below must be a subset of the branches above | ||
branches: [ main ] | ||
schedule: | ||
- cron: '39 8 * * 1' | ||
|
||
jobs: | ||
analyze: | ||
name: Analyze | ||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
language: [ 'csharp' ] | ||
# 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@v3 | ||
|
||
- name: Setup dotnet | ||
uses: actions/setup-dotnet@v4 | ||
with: | ||
dotnet-version: '8.0.x' | ||
|
||
- run: dotnet --info | ||
|
||
# Initializes the CodeQL tools for scanning. | ||
- name: Initialize CodeQL | ||
uses: github/codeql-action/init@v3 | ||
with: | ||
languages: ${{ matrix.language }} | ||
tools: latest | ||
# 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 | ||
|
||
- run: dotnet run --project build -- build | ||
|
||
- name: Perform CodeQL Analysis | ||
uses: github/codeql-action/analyze@v3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"version": 1, | ||
"isRoot": true, | ||
"tools": { | ||
"NuGetKeyVaultSignTool": { | ||
"version": "3.1.6", | ||
"commands": [ | ||
"NuGetKeyVaultSignTool" | ||
] | ||
} | ||
} | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio Version 17 | ||
VisualStudioVersion = 17.6.33717.318 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IdentityServerEmpty", "src\IdentityServerEmpty\IdentityServerEmpty.csproj", "{D324CA74-877A-43AB-B978-38416BBE300A}" | ||
EndProject | ||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IdentityServerInMem", "src\IdentityServerInMem\IdentityServerInMem.csproj", "{6CEEA2E8-C482-4197-93D7-2AC94F99D0D0}" | ||
EndProject | ||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IdentityServerAspNetIdentity", "src\IdentityServerAspNetIdentity\IdentityServerAspNetIdentity.csproj", "{91FA2AC8-1DF5-4A0F-B709-8EFF32B4FA08}" | ||
EndProject | ||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IdentityServerEntityFramework", "src\IdentityServerEntityFramework\IdentityServerEntityFramework.csproj", "{46000F46-B039-49F3-AACD-42E4FBC11E94}" | ||
EndProject | ||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BffLocalApi", "src\BffLocalApi\BffLocalApi.csproj", "{B0948334-5301-41AF-864E-03D335E766B3}" | ||
EndProject | ||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BffRemoteApi", "src\BffRemoteApi\BffRemoteApi.csproj", "{B1E3EDAC-9C5A-4D3B-A6D2-2A1AC0D16728}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{D324CA74-877A-43AB-B978-38416BBE300A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{D324CA74-877A-43AB-B978-38416BBE300A}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{D324CA74-877A-43AB-B978-38416BBE300A}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{D324CA74-877A-43AB-B978-38416BBE300A}.Release|Any CPU.Build.0 = Release|Any CPU | ||
{6CEEA2E8-C482-4197-93D7-2AC94F99D0D0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{6CEEA2E8-C482-4197-93D7-2AC94F99D0D0}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{6CEEA2E8-C482-4197-93D7-2AC94F99D0D0}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{6CEEA2E8-C482-4197-93D7-2AC94F99D0D0}.Release|Any CPU.Build.0 = Release|Any CPU | ||
{91FA2AC8-1DF5-4A0F-B709-8EFF32B4FA08}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{91FA2AC8-1DF5-4A0F-B709-8EFF32B4FA08}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{91FA2AC8-1DF5-4A0F-B709-8EFF32B4FA08}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{91FA2AC8-1DF5-4A0F-B709-8EFF32B4FA08}.Release|Any CPU.Build.0 = Release|Any CPU | ||
{46000F46-B039-49F3-AACD-42E4FBC11E94}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{46000F46-B039-49F3-AACD-42E4FBC11E94}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{46000F46-B039-49F3-AACD-42E4FBC11E94}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{46000F46-B039-49F3-AACD-42E4FBC11E94}.Release|Any CPU.Build.0 = Release|Any CPU | ||
{B0948334-5301-41AF-864E-03D335E766B3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{B0948334-5301-41AF-864E-03D335E766B3}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{B0948334-5301-41AF-864E-03D335E766B3}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{B0948334-5301-41AF-864E-03D335E766B3}.Release|Any CPU.Build.0 = Release|Any CPU | ||
{B1E3EDAC-9C5A-4D3B-A6D2-2A1AC0D16728}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{B1E3EDAC-9C5A-4D3B-A6D2-2A1AC0D16728}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{B1E3EDAC-9C5A-4D3B-A6D2-2A1AC0D16728}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{B1E3EDAC-9C5A-4D3B-A6D2-2A1AC0D16728}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
GlobalSection(ExtensibilityGlobals) = postSolution | ||
SolutionGuid = {32B6CD87-BBD9-4A01-82E9-BA1579E4A083} | ||
EndGlobalSection | ||
EndGlobal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# IdentityServer.Templates | ||
.NET CLI Templates for Duende IdentityServer | ||
|
||
### dotnet new isempty | ||
Creates a minimal Duende IdentityServer project without a UI. | ||
|
||
### dotnet new isui | ||
Adds the quickstart UI to the current project (can be e.g added on top of *isempty*) | ||
|
||
### dotnet new isinmem | ||
Adds a basic Duende IdentityServer with UI, test users and sample clients and resources. | ||
|
||
### dotnet new isaspid | ||
Adds a basic Duende IdentityServer that uses ASP.NET Identity for user management. If you automatically seed the database, you will get two users: `alice` and `bob` - both with password `Pass123$`. Check the `SeedData.cs` file. | ||
|
||
### dotnet new isef | ||
Adds a basic Duende IdentityServer that uses Entity Framework for configuration and state management. If you seed the database, you get a couple of basic client and resource registrations, check the `SeedData.cs` file. | ||
|
||
### dotnet new bff-remoteapi | ||
Creates a basic JavaScript-based BFF host that configures and invokes a remote API via the BFF proxy. | ||
|
||
### dotnet new bff-localapi | ||
Creates a basic JavaScript-based BFF host that invokes a local API co-hosted with the BFF. | ||
|
||
## Installation | ||
|
||
Install with: | ||
|
||
`dotnet new install Duende.IdentityServer.Templates` | ||
|
||
|
||
If you need to set back your dotnet new list to "factory defaults", use this command: | ||
|
||
`dotnet new --debug:reinit` | ||
|
||
|
||
To uninstall the templates, use | ||
|
||
`dotnet new uninstall Duende.IdentityServer.Templates` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
$TOOLS_DIR = Join-Path $PSScriptRoot "tools" | ||
$NUGET_EXE = Join-Path $TOOLS_DIR "nuget.exe" | ||
$NUGET_URL = "https://dist.nuget.org/win-x86-commandline/latest/nuget.exe" | ||
|
||
# Make sure tools folder exists | ||
$PSScriptRoot = Split-Path $MyInvocation.MyCommand.Path -Parent | ||
$ToolPath = Join-Path $PSScriptRoot "tools" | ||
if (!(Test-Path $ToolPath)) { | ||
Write-Verbose "Creating tools directory..." | ||
New-Item -Path $ToolPath -Type directory | out-null | ||
} | ||
|
||
# Attempt to set highest encryption available for SecurityProtocol. | ||
# PowerShell will not set this by default (until maybe .NET 4.6.x). This | ||
# will typically produce a message for PowerShell v2 (just an info | ||
# message though) | ||
try { | ||
# Set TLS 1.2 (3072), then TLS 1.1 (768), then TLS 1.0 (192), finally SSL 3.0 (48) | ||
# Use integers because the enumeration values for TLS 1.2 and TLS 1.1 won't | ||
# exist in .NET 4.0, even though they are addressable if .NET 4.5+ is | ||
# installed (.NET 4.5 is an in-place upgrade). | ||
[System.Net.ServicePointManager]::SecurityProtocol = 3072 -bor 768 -bor 192 -bor 48 | ||
} catch { | ||
Write-Output 'Unable to set PowerShell to use TLS 1.2 and TLS 1.1 due to old .NET Framework installed. If you see underlying connection closed or trust errors, you may need to upgrade to .NET Framework 4.5+ and PowerShell v3' | ||
} | ||
|
||
########################################################################### | ||
# INSTALL NUGET | ||
########################################################################### | ||
|
||
# Try download NuGet.exe if not exists | ||
Write-Host "downloading nuget.exe..." | ||
|
||
$sourceNugetExe = "https://dist.nuget.org/win-x86-commandline/latest/nuget.exe" | ||
$targetNugetExe = "./tools/nuget.exe" | ||
Invoke-WebRequest $sourceNugetExe -OutFile $targetNugetExe | ||
|
||
########################################################################### | ||
# PREPARE BUILD | ||
########################################################################### | ||
Write-Host "build template code..." | ||
|
||
dotnet run --project build | ||
|
||
Write-Host "clean..." | ||
Invoke-Expression "git clean -xdf ./src" | ||
Invoke-Expression "git clean -xdf ./feed" | ||
Invoke-Expression "git clean -xdf ./UI" | ||
|
||
Write-Host "Downloading quickstart UI..." | ||
cd .\UI | ||
iex ((New-Object System.Net.WebClient).DownloadString('https://raw.githubusercontent.com/DuendeSoftware/IdentityServer.Quickstart.UI/main/getmain.ps1')) | ||
cd .. | ||
|
||
dotnet tool restore | ||
dotnet run --project build -- sign |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,127 @@ | ||
using System; | ||
using System.IO; | ||
using static Bullseye.Targets; | ||
using static SimpleExec.Command; | ||
|
||
namespace build | ||
{ | ||
internal static class Program | ||
{ | ||
private const string NugetPackageVersion = "7.0.4"; | ||
|
||
private const string packOutput = "./artifacts"; | ||
private const string envVarMissing = " environment variable is missing. Aborting."; | ||
|
||
private static class Targets | ||
{ | ||
public const string CleanPackOutput = "clean-pack-output"; | ||
public const string Copy = "copy"; | ||
public const string Build = "build"; | ||
public const string Pack = "pack"; | ||
public const string SignPackage = "sign-package"; | ||
} | ||
|
||
internal static void Main(string[] args) | ||
{ | ||
Target(Targets.Build, () => | ||
{ | ||
Run("dotnet", $"build -c Release --nologo"); | ||
}); | ||
|
||
Target(Targets.CleanPackOutput, () => | ||
{ | ||
if (Directory.Exists(packOutput)) | ||
{ | ||
Directory.Delete(packOutput, true); | ||
} | ||
}); | ||
|
||
Target(Targets.Copy, () => | ||
{ | ||
DirectoryCopy("./src", "./feed/content", true); | ||
DirectoryCopy("./ui", "./feed/content/ui", true); | ||
}); | ||
|
||
Target(Targets.Pack, DependsOn(Targets.Copy, Targets.CleanPackOutput), () => | ||
{ | ||
var directory = Directory.CreateDirectory(packOutput).FullName; | ||
|
||
Run("./tools/nuget.exe", $"pack ./feed/Duende.IdentityServer.Templates.nuspec -OutputDirectory {directory} -Version {NugetPackageVersion}"); | ||
}); | ||
|
||
Target(Targets.SignPackage, DependsOn(Targets.Pack), () => | ||
{ | ||
SignNuGet(); | ||
}); | ||
|
||
Target("default", DependsOn(Targets.Build)); | ||
|
||
Target("sign", DependsOn(Targets.SignPackage)); | ||
|
||
RunTargetsAndExit(args, ex => ex is SimpleExec.NonZeroExitCodeException || ex.Message.EndsWith(envVarMissing)); | ||
} | ||
|
||
private static void SignNuGet() | ||
{ | ||
var signClientSecret = Environment.GetEnvironmentVariable("SignClientSecret"); | ||
|
||
if (string.IsNullOrWhiteSpace(signClientSecret)) | ||
{ | ||
throw new Exception($"SignClientSecret{envVarMissing}"); | ||
} | ||
|
||
foreach (var file in Directory.GetFiles(packOutput, "*.nupkg", SearchOption.AllDirectories)) | ||
{ | ||
Console.WriteLine($" Signing {file}"); | ||
|
||
Run("dotnet", | ||
"NuGetKeyVaultSignTool " + | ||
$"sign {file} " + | ||
"--file-digest sha256 " + | ||
"--timestamp-rfc3161 http://timestamp.digicert.com " + | ||
"--azure-key-vault-url https://duendecodesigning.vault.azure.net/ " + | ||
"--azure-key-vault-client-id 18e3de68-2556-4345-8076-a46fad79e474 " + | ||
"--azure-key-vault-tenant-id ed3089f0-5401-4758-90eb-066124e2d907 " + | ||
$"--azure-key-vault-client-secret {signClientSecret} " + | ||
"--azure-key-vault-certificate CodeSigning" | ||
,noEcho: true); | ||
} | ||
} | ||
|
||
private static void DirectoryCopy(string sourceDirName, string destDirName, bool copySubDirs) | ||
{ | ||
// Get the subdirectories for the specified directory. | ||
DirectoryInfo dir = new DirectoryInfo(sourceDirName); | ||
|
||
if (!dir.Exists) | ||
{ | ||
throw new DirectoryNotFoundException( | ||
"Source directory does not exist or could not be found: " | ||
+ sourceDirName); | ||
} | ||
|
||
DirectoryInfo[] dirs = dir.GetDirectories(); | ||
|
||
// If the destination directory doesn't exist, create it. | ||
Directory.CreateDirectory(destDirName); | ||
|
||
// Get the files in the directory and copy them to the new location. | ||
FileInfo[] files = dir.GetFiles(); | ||
foreach (FileInfo file in files) | ||
{ | ||
string tempPath = Path.Combine(destDirName, file.Name); | ||
file.CopyTo(tempPath, true); | ||
} | ||
|
||
// If copying subdirectories, copy them and their contents to new location. | ||
if (copySubDirs) | ||
{ | ||
foreach (DirectoryInfo subdir in dirs) | ||
{ | ||
string tempPath = Path.Combine(destDirName, subdir.Name); | ||
DirectoryCopy(subdir.FullName, tempPath, copySubDirs); | ||
} | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.