0
votes

So I'm currently doing something similar to what was asked IdentityServer3 and external login through OpenIDConnect, except with okta as my external Idp. (tl;dr: I have a local identityserver3 with authenticates to an external Okta Idp via openid Connect).

I'm new to OIDC and identity server 3. My issue has also to do with what to place in the redirectURL. note my local identity server is hosted at https://localhost:5000/core and in my startup code stub is the following

public static void ConfigureIdentityProviders(IAppBuilder app, string signInAsType){

    var openIDOptions = new OpenIdConnectAuthenticationOptions
    {
        AuthenticationType = "oktaOpenID",
        Authority = "https://***********.okta.com",
        Caption = "Okta Via OpenID",
        ClientId = "<client id>",
        ClientSecret = "<client secret>",
        RedirectUri = "https://localhost:5000/core", 
        ResponseType = "code",
        Scope = "openid email profile",
        SignInAsAuthenticationType = signInAsType
    }
}

The issue is with the callback. When i authenthicate against OKTA (my external OICD idp), it redirects to https://localhost:5000/core but the browser prints

{
    Message: "The requested resource does not support http method 'POST'."
}

I have a feeling i need to create an endpoint like https://localhost:5000/core/OIDC

which will accept the post parameters code and state from okta, then pass the code back to the okta token endpoint, but i have no idea where to start.

Any help? I tried creating a class similar to that defined in IdentityServer3 and external login through OpenIDConnect but i was getting build errors since i don't know what libraries/packages were included in spatialguy's project.

1

1 Answers

1
votes

Well i figured it out. I had to go through, with a fine toothed comb spatialguy's solution for IdentityServer3 and external login through OpenIDConnect

high level changes i made: 1)I needed to create the a new custom middleware application which is based on https://github.com/aspnet/AspNetKatana/blob/dev/src/Microsoft.Owin.Security.OpenIdConnect/OpenIdConnectAuthenticationMiddleware.cs, but overides the AuthenticationHandler method to use the custom authenthication handler instead of OpenIdConnectAuthenticationHandler.

2) mashed both code sets (ASPNetKatana's and SpatialGuys), wen twith a fine tooth comb to fix stuff like depreciated methods.

3) changed the call to getclaims and getToken to use "/oauth2/v1/userinfo" and "/oauth2/v1/token" instead of "/userinfo" and "token" as okta uses the above endpoints