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

Extend token end point and MatchEndPoint not found #1491

Closed
1 task done
salimz22 opened this issue Aug 1, 2022 · 5 comments
Closed
1 task done

Extend token end point and MatchEndPoint not found #1491

salimz22 opened this issue Aug 1, 2022 · 5 comments

Comments

@salimz22
Copy link

salimz22 commented Aug 1, 2022

Confirm you've already contributed to this project or that you sponsor it

  • I confirm I'm a sponsor or a contributor

Version

3.x

Describe the bug

Hi,

  1. Our requirement is to extend token which is received from token endpoint and add an additional scope while calling other microservice endpoint. In order to achieve this, we need to have additional token endpoint '/connect/extend'
    which would add additional scopes using existing token and create a extended JWT token to authorize the request..
    Can you assist to resolve this

You have mentioned in below article about to support new token endpoint using 'MatchEndPoint' handler (https://kevinchalet.com/2018/07/02/implementing-advanced-scenarios-using-the-new-openiddict-rc3-events-model/)
options.AddEventHandler<OpenIddictServerEvents.MatchEndpoint>(notification =>
{}

However, am not able to get 'MatchEndpoint' handler. Have looked at the entire github source code that also does not contain this event (MatchEndpoint).
Could you please assist to resolve this.

To reproduce

Exceptions (if any)

-
@salimz22 salimz22 added the bug label Aug 1, 2022
@kevinchalet
Copy link
Member

Hey,

Our requirement is to extend token which is received from token endpoint and add an additional scope while calling other microservice endpoint. In order to achieve this, we need to have additional token endpoint '/connect/extend'
which would add additional scopes using existing token and create a extended JWT token to authorize the request.

That scenario sounds a lot like delegation, which is not supported (yet) in OpenIddict: #1249.

However, am not able to get 'MatchEndpoint' handler. Have looked at the entire github source code that also does not contain this event (MatchEndpoint).

The event you're looking for has been replaced by ProcessRequest(Context) in 3.0 and higher. Here's an example for ASP.NET Core:

options.AddEventHandler<ProcessRequestContext>(builder =>
{
    builder.UseInlineHandler(context =>
    {
        var request = context.Transaction.GetHttpRequest() ?? throw new InvalidOperationException();

        if (context.EndpointType is OpenIddictServerEndpointType.Unknown &&
            request.Path == "/connect/other-token-endpoint")
        {
            context.EndpointType = OpenIddictServerEndpointType.Token;
        }

        return default;
    });

    builder.SetOrder(InferEndpointType.Descriptor.Order + 1);
});

@salimz22
Copy link
Author

salimz22 commented Aug 1, 2022 via email

@kevinchalet
Copy link
Member

Thanks Kevin for your response. Regarding the first query of delegation, you mentioned Openiddict does not support it at this moment. Is there any workaround to achieve this ? If yes, please let us know the details.

Delegation as defined in RFC8693 is a fairly complex thing so it can't be implemented trivially using a "workaround", I'm afraid 😄

That said, if you're interested in sponsoring that feature, let me know.

@salimz22
Copy link
Author

salimz22 commented Aug 1, 2022 via email

@kevinchalet
Copy link
Member

@salimz22 you can email me at contact [at] kevinchalet [dot] com to discuss the details 😃

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants