aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore6
-rw-r--r--Libs/VNLib.Plugins.Essentials.Oauth/src/Applications/ApplicationStore.cs6
-rw-r--r--Module.Taskfile.yaml68
-rw-r--r--Plugins/OAuth2ClientApplications/src/Endpoints/ApplicationEndpoint.cs4
-rw-r--r--README.md13
-rw-r--r--Taskfile.yaml75
-rw-r--r--vnlib.plugins.essentials.oauth.build.sln39
7 files changed, 197 insertions, 14 deletions
diff --git a/.gitignore b/.gitignore
index 0660f74..63641d6 100644
--- a/.gitignore
+++ b/.gitignore
@@ -473,8 +473,4 @@ FodyWeavers.xsd
# End of https://www.toptal.com/developers/gitignore/api/c,c++,visualstudio
-*.json
-/.task/checksum
-*[Tt]askfile.*
-*.ps1
-*.sln \ No newline at end of file
+*.json \ No newline at end of file
diff --git a/Libs/VNLib.Plugins.Essentials.Oauth/src/Applications/ApplicationStore.cs b/Libs/VNLib.Plugins.Essentials.Oauth/src/Applications/ApplicationStore.cs
index 8374c21..da70a17 100644
--- a/Libs/VNLib.Plugins.Essentials.Oauth/src/Applications/ApplicationStore.cs
+++ b/Libs/VNLib.Plugins.Essentials.Oauth/src/Applications/ApplicationStore.cs
@@ -180,7 +180,7 @@ namespace VNLib.Plugins.Essentials.Oauth.Applications
/// </summary>
/// <param name="record">The new record to create</param>
/// <returns>The result of the operation</returns>
- public override async Task<ERRNO> CreateAsync(UserApplication record)
+ public override async Task<ERRNO> CreateAsync(UserApplication record, CancellationToken cancellation = default)
{
record.RawSecret = GenerateSecret();
//Hash the secret
@@ -188,7 +188,7 @@ namespace VNLib.Plugins.Essentials.Oauth.Applications
record.ClientId = GenerateClientID();
record.SecretHash = (string)secretHash;
//Wait for the rescord to be created before wiping the secret
- return await base.CreateAsync(record);
+ return await base.CreateAsync(record, cancellation);
}
/// <summary>
@@ -276,7 +276,7 @@ namespace VNLib.Plugins.Essentials.Oauth.Applications
}
//DO NOT ALLOW PAGINATION YET
- public override Task<int> GetPageAsync(ICollection<UserApplication> collection, int page, int limit)
+ public override Task<int> GetPageAsync(ICollection<UserApplication> collection, int page, int limit, CancellationToken cancellation = default)
{
throw new NotSupportedException();
}
diff --git a/Module.Taskfile.yaml b/Module.Taskfile.yaml
new file mode 100644
index 0000000..d729ea3
--- /dev/null
+++ b/Module.Taskfile.yaml
@@ -0,0 +1,68 @@
+# https://taskfile.dev
+
+#Called by the vnbuild system to produce builds for my website
+#https://www.vaughnnugent.com/resources/software
+
+#This taskfile performs the build operations for a module, it handles
+#git code updates, msbuild on solutions, and sleet NuGet feed pushes.
+
+#this file must be in the same directory as the solution file
+
+version: '3'
+
+vars:
+ INT_DIR: '{{.SCRATCH_DIR}}/obj/{{.MODULE_NAME}}/'
+ MS_ARGS: '/p:RunAnalyzersDuringBuild=false /p:IntermediateOutputPath="{{.INT_DIR}}" /p:UseCommonOutputDirectory=true /p:BuildInParallel=true /p:MultiProcessorCompilation=true'
+ PACK_OUT: '{{.OUTPUT_DIR}}/{{.HEAD_SHA}}/pkg'
+
+tasks:
+
+#called by build pipeline to sync repo
+ update:
+ cmds:
+ - git remote update
+ - git reset --hard
+ - git pull origin {{.BRANCH_NAME}} --verify-signatures
+
+#called by build pipeline to build module
+ build:
+ cmds:
+ - echo "building module {{.MODULE_NAME}}"
+
+ #re-write semver after hard reset, before build
+ - dotnet-gitversion.exe /updateprojectfiles
+
+ #build debug mode first
+ - task: build_debug
+ - task: build_release
+
+ postbuild_success:
+ cmds:
+ #push packages to the sleet feed (feed path is vnbuild global)
+ - sleet push "{{.PACK_OUT}}/debug/" --source debug --config "{{.SLEET_CONFIG_PATH}}" --force
+ - sleet push "{{.PACK_OUT}}/release/" --source release --config "{{.SLEET_CONFIG_PATH}}" --force
+
+ postbuild_failed:
+ cmds:
+ - echo "postbuild failed {{.MODULE_NAME}}"
+
+#called by build pipeline to clean module
+ clean:
+ cmds:
+ #clean solution
+ - dotnet clean /p:BuildInParallel=true /p:MultiProcessorCompilation=true
+
+
+#Internal tasks
+ build_debug:
+ internal: true
+ cmds:
+ - dotnet publish -c debug {{.MS_ARGS}}
+ - dotnet pack -c debug {{.MS_ARGS}} -o "{{.PACK_OUT}}/debug/"
+
+ build_release:
+ internal: true
+ cmds:
+ - dotnet publish -c release {{.MS_ARGS}}
+ - dotnet pack -c release {{.MS_ARGS}} -o "{{.PACK_OUT}}/release/"
+ \ No newline at end of file
diff --git a/Plugins/OAuth2ClientApplications/src/Endpoints/ApplicationEndpoint.cs b/Plugins/OAuth2ClientApplications/src/Endpoints/ApplicationEndpoint.cs
index 0966111..0f253fa 100644
--- a/Plugins/OAuth2ClientApplications/src/Endpoints/ApplicationEndpoint.cs
+++ b/Plugins/OAuth2ClientApplications/src/Endpoints/ApplicationEndpoint.cs
@@ -98,7 +98,7 @@ namespace OAuth2ClientApplications.Endpoints
try
{
//Get all applications to fill the list
- _ = await Applications.GetCollectionAsync(applications, ev.Session.UserID, MaxAppsPerUser);
+ _ = await Applications.GetCollectionAsync(applications, ev.Session.UserID, MaxAppsPerUser, ev.EventCancellation);
//Write response (will convert json as needed before releasing the list)
ev.CloseResponseJson(HttpStatusCode.OK, applications);
return VfReturnType.VirtualSkip;
@@ -278,7 +278,7 @@ namespace OAuth2ClientApplications.Endpoints
}
//See if the user has enough room for more apps
- long appCount = await Applications.GetCountAsync(entity.Session.UserID);
+ long appCount = await Applications.GetCountAsync(entity.Session.UserID, entity.EventCancellation);
if (appCount == -1)
{
diff --git a/README.md b/README.md
index 54d7186..b975c12 100644
--- a/README.md
+++ b/README.md
@@ -1,9 +1,14 @@
# OAuth2
*A collection of libraries and plugins for developing OAuth2 applications or plugins*
-#### Builds
-Debug build w/ symbols & xml docs, release builds, NuGet packages, and individually packaged source code are available on my [website](https://www.vaughnnugent.com/resources/software). All tar-gzip (.tgz) files will have an associated .sha384 appended checksum of the desired download file.
+## Builds
+Debug build w/ symbols & xml docs, release builds, NuGet packages, and individually packaged source code are available on my website (link below). All tar-gzip (.tgz) files will have an associated .sha256 appended checksum of the desired download file.
-## License
+## Docs and Guides
+Documentation, specifications, and setup guides are available on my website.
-Licenses may vary depending on the project. Each project will contain a license file and applicable licensing information in the project's readme. \ No newline at end of file
+[Docs and Articles](https://www.vaughnnugent.com/resources/software/articles?tags=docs,_vnlib.plugins.essentials.oauth)
+[Builds and Source](https://www.vaughnnugent.com/resources/software/modules/VNLib.Core)
+
+## License
+The software in this repository is licensed under the GNU GPL version 2.0 (or any later version). See the LICENSE files for more information. \ No newline at end of file
diff --git a/Taskfile.yaml b/Taskfile.yaml
new file mode 100644
index 0000000..b16b082
--- /dev/null
+++ b/Taskfile.yaml
@@ -0,0 +1,75 @@
+# https://taskfile.dev
+
+#Called by the vnbuild system to produce builds for my website
+#https://www.vaughnnugent.com/resources/software
+
+#This taskfile is called from the root of a project that is being built
+#and the purpose of this taskfile is to package up the output of a build
+#from the solution file, and package it up into a tgz files for distribution
+
+version: '3'
+
+vars:
+ TARGET: '{{.USER_WORKING_DIR}}/bin'
+ RELEASE_DIR: "./bin/release/{{.TARGET_FRAMEWORK}}/publish"
+ SOURCE_OUT: "{{.USER_WORKING_DIR}}/bin/source"
+
+tasks:
+
+ #when build succeeds, archive the output into a tgz
+ postbuild_success:
+ dir: '{{.USER_WORKING_DIR}}'
+ cmds:
+ #pack up source code
+ - task: packsource
+
+ #run post in debug mode
+ - task: postbuild
+ vars: { BUILD_MODE: debug }
+
+ #remove uncessary files from the release dir
+ - powershell -Command "Get-ChildItem -Recurse '{{.RELEASE_DIR}}/' -Include *.pdb,*.xml | Remove-Item"
+
+ #run post in release mode
+ - task: postbuild
+ vars: { BUILD_MODE: release }
+
+
+ postbuild_failed:
+ dir: '{{.USER_WORKING_DIR}}'
+ cmds:
+ - echo "postbuild failed {{.PROJECT_NAME}}"
+
+
+ postbuild:
+ dir: '{{.USER_WORKING_DIR}}'
+ internal: true
+ vars:
+ #the build output directory
+ BUILD_OUT: "{{.USER_WORKING_DIR}}/bin/{{.BUILD_MODE}}/{{.TARGET_FRAMEWORK}}/publish"
+
+ cmds:
+
+ #copy license and readme to target
+ - cd .. && powershell -Command "Copy-Item -Path ./LICENSE.txt -Destination '{{.BUILD_OUT}}/license.txt'"
+ - cd .. && powershell -Command "Copy-Item -Path ./build.readme.md -Destination '{{.BUILD_OUT}}/readme.md'"
+
+ #tar outputs
+ - cd "{{.BUILD_OUT}}" && tar -czf "{{.TARGET}}/{{.BUILD_MODE}}.tgz" .
+
+ packsource:
+ dir: '{{.USER_WORKING_DIR}}'
+ internal: true
+ cmds:
+ #copy source code to target
+ - powershell -Command "Get-ChildItem -Include *.cs,*.csproj -Recurse | Where { \$_.FullName -notlike '*\obj\*' -and \$_.FullName -notlike '*\bin\*' } | Resolve-Path -Relative | tar --files-from - -czf '{{.TARGET}}/src.tgz'"
+
+
+#Remove the output dirs on clean
+ clean:
+ dir: '{{.USER_WORKING_DIR}}'
+ cmds:
+ - cmd: powershell Remove-Item -Recurse './bin'
+ ignore_error: true
+ - cmd: powershell Remove-Item -Recurse './obj'
+ ignore_error: true
diff --git a/vnlib.plugins.essentials.oauth.build.sln b/vnlib.plugins.essentials.oauth.build.sln
new file mode 100644
index 0000000..96be675
--- /dev/null
+++ b/vnlib.plugins.essentials.oauth.build.sln
@@ -0,0 +1,39 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 17
+VisualStudioVersion = 17.0.31903.59
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "VNLib.Plugins.Essentials.Oauth", "Libs\VNLib.Plugins.Essentials.Oauth\src\VNLib.Plugins.Essentials.Oauth.csproj", "{43E1F55C-F7FB-4ADC-A6DA-1C5FC183C673}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OAuth2ClientApplications", "Plugins\OAuth2ClientApplications\src\OAuth2ClientApplications.csproj", "{34565079-518B-4D2D-A6FF-CA448BE2B490}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{1AA45BF3-41BA-44FF-95FB-DC350F3A1EFB}"
+ ProjectSection(SolutionItems) = preProject
+ .gitattributes = .gitattributes
+ .gitignore = .gitignore
+ .onedev-buildspec.yml = .onedev-buildspec.yml
+ README.md = README.md
+ EndProjectSection
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {43E1F55C-F7FB-4ADC-A6DA-1C5FC183C673}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {43E1F55C-F7FB-4ADC-A6DA-1C5FC183C673}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {43E1F55C-F7FB-4ADC-A6DA-1C5FC183C673}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {43E1F55C-F7FB-4ADC-A6DA-1C5FC183C673}.Release|Any CPU.Build.0 = Release|Any CPU
+ {34565079-518B-4D2D-A6FF-CA448BE2B490}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {34565079-518B-4D2D-A6FF-CA448BE2B490}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {34565079-518B-4D2D-A6FF-CA448BE2B490}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {34565079-518B-4D2D-A6FF-CA448BE2B490}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {F22AA9AD-D962-400A-B7FE-96277B05665F}
+ EndGlobalSection
+EndGlobal