Skip to content
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

Attribute based event subscriptions #84

Open
bryanapellanes-okta opened this issue Dec 1, 2021 · 3 comments
Open

Attribute based event subscriptions #84

bryanapellanes-okta opened this issue Dec 1, 2021 · 3 comments
Assignees
Labels
question Further information is requested

Comments

@bryanapellanes-okta
Copy link
Contributor

User story

"As an okta-oidc-xamarin third party developer, I want to mark class methods with event related custom attributes so that they are automatically subscribed to Okta authentication related events."

Proposed solution

  • Define custom attributes that relate one for one to each event defined in OktaContext.
  • During Okta platform initialization scan asynchronously for methods adorned with event based custom attributes, accepting a filter to limit the total number of assemblies/classes/methods scanned, and automatically subscribe those methods to the relevant events.

Alternatives considered

Manually write code that subscribes to events of interest.

Additional information

Looking for feedback and comments to determine how valuable this would be.

@bryanapellanes-okta bryanapellanes-okta self-assigned this Dec 1, 2021
@bretterer bretterer added the question Further information is requested label Dec 1, 2021
@Quorralyne
Copy link

Can you provide an example in pseudo-code?

@bryanapellanes-okta
Copy link
Contributor Author

Can you provide an example in pseudo-code?

The idea is to allow someone to write a class similar to the following and have methods automatically subscribed to relevant events without additional code needed:

public class MyOktaEventHandlers
{
    [OnSignInCompleted]
    public void LogSignIn(object sender, SignInEventArgs signInEventArgs)
    {
        ClaimsPrincipal claimsPrincipal = signInEventArg.StateManager.GetClaimsPrincipalAsync().Result;
        // ... do something with claims principal
        Console.WriteLine("Sign in completed");
    }
}

@bryanapellanes-okta
Copy link
Contributor Author

@Quorralyne please see previous comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants