Skip to content

Implement auth code flow for the custom endpoint #244

Open
@ParagKale-SSE

Description

@ParagKale-SSE

Hi,

I implemented a custom endpoint for the durable functions monitor as explained below

`namespace DurableFunctionsMonitor.DotNetIsolated
{
public class MyCustomDfMonEndpoint: ServeStatics
{
public MyCustomDfMonEndpoint(DfmSettings dfmSettings, DfmExtensionPoints extensionPoints, ILoggerFactory loggerFactory) :
base(dfmSettings, extensionPoints, loggerFactory)
{
}

    [Function(nameof(MyCustomDfMonEndpoint))]
    public Task<HttpResponseData> ServeDfMonStatics(
        [HttpTrigger(AuthorizationLevel.Anonymous, "get", Route = "/{p1?}/{p2?}/{p3?}")] HttpRequestData req,
        string p1,
        string p2,
        string p3
    )
    {
        return this.DfmServeStaticsFunction(req, p1, p2, p3);
    }
}

}`

I am trying to set up authentication as explained in https://learn.microsoft.com/en-us/entra/identity-platform/v2-oauth2-auth-code-flow for this specific endpoint. For some reasons, we can't set up a dedicated function app just for the durable functions monitor and also in our main function app , we don't want to set up easy auth authentication .

What we are trying to achieve is get a auth code and access token via a app registration and then authenticate this specific custom end point.

What I noticed is , when the statement return this.DfmServeStaticsFunction(req, p1, p2, p3); is executed , the http triggered function is called again. This results in the auth code used again to get the token and the exception is generated that the auth code has already been redeemed for the access token

Is there any workaround to provide authentication just for this custom end point ? Or anyway to implement auth code flow for this end point in the function app ?

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions