-
-
Notifications
You must be signed in to change notification settings - Fork 39
Small cleanup #87
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Small cleanup #87
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
ab8c0c1
fixes #50
sungam3r b010870
update for ValidateAsync
sungam3r f5765a6
Merge branch 'master' of github.com:graphql-dotnet/authorization into…
sungam3r 49981a9
fixes
sungam3r 9cae8a3
revert
sungam3r 8867218
small cleanup
sungam3r ad0edd5
label
sungam3r 4f182e7
fix
sungam3r 4c12754
fix
sungam3r 45c3bcb
fix #61
sungam3r 91b7e14
bump version
sungam3r 9c730f9
xmldocs + small optimize
sungam3r 872d281
xmldocs
sungam3r 5686f55
xmldocs
sungam3r f407161
optimize authorization result + xmldocs
sungam3r 34b4cc6
nowarns, docs
sungam3r 34ec303
fix api test
sungam3r ab34e95
revert change in harness
sungam3r a048628
Merge branch 'master' of github.com:graphql-dotnet/authorization into…
sungam3r 59b0fca
revert changes in favor of simplicity
sungam3r File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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,10 @@ | ||
| using System.Collections.Generic; | ||
| using System.Security.Claims; | ||
|
|
||
| namespace GraphQL.Authorization.Tests | ||
| { | ||
| internal class GraphQLUserContext : Dictionary<string, object>, IProvideClaimsPrincipal | ||
| { | ||
| public ClaimsPrincipal User { get; set; } | ||
| } | ||
| } |
This file contains hidden or 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
This file contains hidden or 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 |
|---|---|---|
| @@ -1,22 +1,33 @@ | ||
| using System.Collections.Generic; | ||
| using System; | ||
| using System.Collections.Generic; | ||
|
|
||
| namespace GraphQL.Authorization | ||
| { | ||
| public interface IAuthorizationPolicy | ||
| { | ||
| IEnumerable<IAuthorizationRequirement> Requirements { get; } | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Default implementation for <see cref="IAuthorizationPolicy"/>. | ||
| /// </summary> | ||
| public class AuthorizationPolicy : IAuthorizationPolicy | ||
| { | ||
| private readonly List<IAuthorizationRequirement> _requirements; | ||
| private readonly List<IAuthorizationRequirement> _requirements = new List<IAuthorizationRequirement>(); | ||
|
|
||
| /// <summary> | ||
| /// Creates a policy with a set of specified requirements. | ||
| /// </summary> | ||
| /// <param name="requirements">Specified requirements.</param> | ||
| public AuthorizationPolicy(IEnumerable<IAuthorizationRequirement> requirements) | ||
| { | ||
| _requirements = new List<IAuthorizationRequirement>( | ||
| requirements ?? new List<IAuthorizationRequirement>()); | ||
| if (requirements != null) | ||
| { | ||
| _requirements.AddRange(requirements); | ||
| _requirements.ForEach(req => | ||
| { | ||
| if (req == null) | ||
| throw new ArgumentNullException(nameof(requirements), $"One of the ({_requirements.Count}) requirements is null"); | ||
| }); | ||
| } | ||
| } | ||
|
|
||
| /// <inheritdoc /> | ||
| public IEnumerable<IAuthorizationRequirement> Requirements => _requirements; | ||
| } | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.