Skip to content
This repository was archived by the owner on Dec 24, 2020. It is now read-only.

Introduce events support #18

Closed

Conversation

MonkeyJamboree
Copy link
Contributor

I needed the functionality so I went ahead and finished up the work on #2. There are a couple missing unit tests for the introspection events, but should work knock on wood.

Thanks for the initial work @DovydasNavickas! I cherry-picked what you'd already done and finished the work up for all of the projects in this repo.

@kevinchalet kevinchalet changed the title Features/events Introduce events support Apr 1, 2016
@kevinchalet kevinchalet added this to the 1.0.0-alpha1 milestone Apr 1, 2016
@kevinchalet kevinchalet self-assigned this Apr 1, 2016
@DovydasNavickas
Copy link

Well, I owe you one then.
I hope at least to finish the unit tests for introspection later then.

using Newtonsoft.Json.Linq;

namespace AspNet.Security.OAuth.Introspection {
public class IntrospectTokenContext : BaseIntrospectionContext {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IntrospectTokenContext -> IntrospectionTokenContext?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My bad, just noticed that this is meant for an action, as if please introspect the token 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah. Do you think the naming should be clearer? Something like InitiateIntrospectionRequestContext or similar?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BeSoKindAndIntrospectThisTokenContext.cs would be a polite and clear way of saying what this has to do.. 😄
Hmm... IntrospectIncomingToken, sth like that?..
When you understand the intention of this event, the name looks clear. But when you see it for the first time - I got confused, so can other people.

@MonkeyJamboree
Copy link
Contributor Author

I'll work on the build issues and push some fixed code for that shortly. @DovydasNavickas thanks for all the feedback and spell-checking! 👍

@MonkeyJamboree
Copy link
Contributor Author

Should be able to pull this in now unless there are more complaints about things 😉

@DovydasNavickas
Copy link

Nice: RequestTokenIntrospection 👍

using Microsoft.AspNetCore.Http;

namespace AspNet.Security.OAuth.Introspection {
public class AccessTokenReceivedContext : BaseIntrospectionContext {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please consider adding some XML documentation love for all the public stuff 😄

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will do when I have another spare minute or three.

@kevinchalet
Copy link
Member

Minor a few remarks, it looks nice (and it builds!) 👏

protected override async Task<AuthenticateResult> HandleAuthenticateAsync()
{
// Give the application an opportunity to parse the token from a different location, adjust, or reject token
var accessTokenReceivedContext = new AccessTokenReceivedContext(Context, Options);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we try to parse the Authorization header before invoking the event to let the dev' adjust it or are fine with the current order?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If so, we can't return the multiple failure messages while doing the parsing, and if they're not using the header at all it makes sense (at least to me) to skip that processing entirely.

/// <summary>
/// Invoked when audiences are to be validated for a message.
/// </summary>
Task ValidateAudience(ValidateAudienceContext context);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't forget to kill this event 👏

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I was focusing on one middleware at a time and ran into the issue I had. It'll be gone 👍

@MonkeyJamboree MonkeyJamboree force-pushed the Features/Events branch 2 times, most recently from 181b7af to 7fb1214 Compare April 3, 2016 02:50
@MonkeyJamboree MonkeyJamboree force-pushed the Features/Events branch 5 times, most recently from 041aaf1 to b8e1c47 Compare April 7, 2016 03:48
@kevinchalet
Copy link
Member

Merged: a1951c7

@MonkeyJamboree @DovydasNavickas thanks for your contribution guys! 👏

@MonkeyJamboree MonkeyJamboree deleted the Features/Events branch April 20, 2016 19:14
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Development

Successfully merging this pull request may close these issues.

3 participants