-
Notifications
You must be signed in to change notification settings - Fork 413
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
New validation model - Public API review #3060
base: dev
Are you sure you want to change the base?
Conversation
… of GetCurrentStackFrame() and AddCurrentStackFrame()
…fields onto their own files and made the structures read-only.
…g IList values from two-part constructors.
… no ActorValidationParameters are provided.
…once the classes/structures are made public.
… public. Added to PublicAPI.Unshipped
…om annotated code
…n M.IM.Tokens for all classes not belonging to the new validation path so they can be updated incrementally
…led warnings about public APIs missing nullability annotations in M.IM.JsonWebToken for all classes not belonging to the new validation path so they can be updated incrementally
…bled warnings about public APIs missing nullability annotations in M.IM.Tokens.Saml and M.IM.Tokens.Saml2 for all classes not belonging to the new validation path so they can be updated incrementally
Moved out of draft to trigger validations. Will move back. |
@iNinja is the idea to ship the preview off of |
@jennyf19 yes, that would be best from my perspective, as we need to make many classes and methods public that we don't want to expose on dev. I'll turn this PR back to draft, I moved it out of it to trigger the validations. |
SummarySummary
CoverageMicrosoft.IdentityModel.JsonWebTokens - 80.3%
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
- We'd want to have the cancellation token in the public API have a default value
default(CancellationToken)
Not blocking, but incremental:
- Let's have ToString() methods on the ValidatinSource, and the ValidatedXXX classes. This is nicer when debugging.
- We need to document better the overrides of ValidateTokenAsync in JSonWebTokenHandler. I'll propose something.
- We'd probably want to have code snippets in the validation Error class. I'll propose something.
/// <exception cref="SecurityTokenMalformedException">Returned if <paramref name="token"/> is not a valid <see cref="JsonWebToken"/>, <see cref="ReadToken(string, CallContext)"/></exception> | ||
/// <exception cref="SecurityTokenMalformedException">Returned if the validationParameters.TokenReader delegate is not able to parse/read the token as a valid <see cref="JsonWebToken"/>, <see cref="ReadToken(string, CallContext)"/></exception> | ||
internal async Task<ValidationResult<ValidatedToken>> ValidateTokenAsync( | ||
public async Task<ValidationResult<ValidatedToken>> ValidateTokenAsync( | ||
string token, | ||
ValidationParameters validationParameters, | ||
CallContext callContext, | ||
CancellationToken cancellationToken) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a best practice to no impose the usage of CancellationToken, by providing the default value:
CancellationToken cancellationToken) | |
CancellationToken cancellationToken = default(CancellationToken)) |
/// </summary> | ||
/// <param name="logger">The <see cref="ILogger"/> to be used for logging.</param> | ||
[CLSCompliant(false)] | ||
public void Log(ILogger logger) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be public?
Is it meant to be used by users?
Or maybe just frameworks on top of Wilson? In which case would we want to have an explicit interface implementation?
@@ -240,7 +256,7 @@ public ValidationError AddStackFrame(StackFrame stackFrame) | |||
/// <param name="lineNumber">The line number from which this method is called. CAptured automatically by default.</param> | |||
/// <param name="skipFrames">The number of stack frames to skip when capturing. Used to avoid capturing this method and get the caller instead.</param> | |||
/// <returns>The updated object.</returns> | |||
internal ValidationError AddCurrentStackFrame([CallerFilePath] string filePath = "", [CallerLineNumber] int lineNumber = 0, int skipFrames = 1) | |||
public ValidationError AddCurrentStackFrame([CallerFilePath] string filePath = "", [CallerLineNumber] int lineNumber = 0, int skipFrames = 1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same question. Should it be public? what is the scenario?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same question for NullParameter().
SummarySummary
CoverageMicrosoft.IdentityModel.JsonWebTokens - 80.3%
|
* Adding end to end tests * Update
SummarySummary
CoverageMicrosoft.IdentityModel.JsonWebTokens - 80.3%
|
New Validation Model - Public API review
This PR is based off #3056, so some changes will show up here until that one is merged.
Note: This branch currently won't build because of some issues with the way the public API analyzers work when there is nullability annotations partially implemented. Working on a fix as well as making APIs public in JsonWebTokens and SAML/SAML2.
This PR is not to be merged.