Integrating Identity Server; Docker and MVC Core (Web Client)












2















I am trying to get an MVC Core Web application to work with Identity Server and Docker. Here are the steps I have taken:



1) Download the quickstart: https://github.com/IdentityServer/IdentityServer4.Samples/tree/dev



Run the project and see it working as expected. Now try adding Docker to the equation:



2) Open the solution. Right click on: IdentityServerWithAspNetIdentity and select: Add Container Orchestration Support (Then Docker Compose, then Linux).
3) Right click on MVCClient and select: Add Container Orchestration Support (Then Docker Compose, then Linux).
4) Change Docker-compose.override.yml to this (note that I only changed the ports for each service from 80 to 5002:80 and 5000:80):



version: '3.4'

services:
mvcclient:
environment:
- ASPNETCORE_ENVIRONMENT=Development
ports:
- "5002:80"

identityserverwithaspnetidentity:
environment:
- ASPNETCORE_ENVIRONMENT=Development
ports:
- "5000:80"


5) Try running the project to see what happens. When I attempt to access: Home/Secure; instead of being forwarded to the login webpage; I see this error: 'Unable to obtain configuration from:http://localhost:5000/.well-known/openid-configuration'.



I believe this is because the Docker container cannot see localhost:5000. Therefore after reading through a few blog posts; I try this:



6) Open startup in the MVCClient and change this:



options.Authority = "http://localhost:5000";


to this:



options.Authority = "http://identityserverwithaspnetidentity:80";


However, I just see a DNS error (404 I believe). What do I need to do to get Identity Server working with an MVC web app in this case?



So far I have looked here: How can I use IdentityServer4 from inside and outside a docker machine? and here: Identity Server 4 and docker. However the answers have not helped so far.










share|improve this question























  • Were you able to make this work eventually? I am stuck with the same issue now.

    – Sara
    Jan 14 at 12:50











  • @Sara, yes it is now working as expected. What problem are you having? Have you posted a question?

    – w0051977
    Jan 14 at 14:42
















2















I am trying to get an MVC Core Web application to work with Identity Server and Docker. Here are the steps I have taken:



1) Download the quickstart: https://github.com/IdentityServer/IdentityServer4.Samples/tree/dev



Run the project and see it working as expected. Now try adding Docker to the equation:



2) Open the solution. Right click on: IdentityServerWithAspNetIdentity and select: Add Container Orchestration Support (Then Docker Compose, then Linux).
3) Right click on MVCClient and select: Add Container Orchestration Support (Then Docker Compose, then Linux).
4) Change Docker-compose.override.yml to this (note that I only changed the ports for each service from 80 to 5002:80 and 5000:80):



version: '3.4'

services:
mvcclient:
environment:
- ASPNETCORE_ENVIRONMENT=Development
ports:
- "5002:80"

identityserverwithaspnetidentity:
environment:
- ASPNETCORE_ENVIRONMENT=Development
ports:
- "5000:80"


5) Try running the project to see what happens. When I attempt to access: Home/Secure; instead of being forwarded to the login webpage; I see this error: 'Unable to obtain configuration from:http://localhost:5000/.well-known/openid-configuration'.



I believe this is because the Docker container cannot see localhost:5000. Therefore after reading through a few blog posts; I try this:



6) Open startup in the MVCClient and change this:



options.Authority = "http://localhost:5000";


to this:



options.Authority = "http://identityserverwithaspnetidentity:80";


However, I just see a DNS error (404 I believe). What do I need to do to get Identity Server working with an MVC web app in this case?



So far I have looked here: How can I use IdentityServer4 from inside and outside a docker machine? and here: Identity Server 4 and docker. However the answers have not helped so far.










share|improve this question























  • Were you able to make this work eventually? I am stuck with the same issue now.

    – Sara
    Jan 14 at 12:50











  • @Sara, yes it is now working as expected. What problem are you having? Have you posted a question?

    – w0051977
    Jan 14 at 14:42














2












2








2


1






I am trying to get an MVC Core Web application to work with Identity Server and Docker. Here are the steps I have taken:



1) Download the quickstart: https://github.com/IdentityServer/IdentityServer4.Samples/tree/dev



Run the project and see it working as expected. Now try adding Docker to the equation:



2) Open the solution. Right click on: IdentityServerWithAspNetIdentity and select: Add Container Orchestration Support (Then Docker Compose, then Linux).
3) Right click on MVCClient and select: Add Container Orchestration Support (Then Docker Compose, then Linux).
4) Change Docker-compose.override.yml to this (note that I only changed the ports for each service from 80 to 5002:80 and 5000:80):



version: '3.4'

services:
mvcclient:
environment:
- ASPNETCORE_ENVIRONMENT=Development
ports:
- "5002:80"

identityserverwithaspnetidentity:
environment:
- ASPNETCORE_ENVIRONMENT=Development
ports:
- "5000:80"


5) Try running the project to see what happens. When I attempt to access: Home/Secure; instead of being forwarded to the login webpage; I see this error: 'Unable to obtain configuration from:http://localhost:5000/.well-known/openid-configuration'.



I believe this is because the Docker container cannot see localhost:5000. Therefore after reading through a few blog posts; I try this:



6) Open startup in the MVCClient and change this:



options.Authority = "http://localhost:5000";


to this:



options.Authority = "http://identityserverwithaspnetidentity:80";


However, I just see a DNS error (404 I believe). What do I need to do to get Identity Server working with an MVC web app in this case?



So far I have looked here: How can I use IdentityServer4 from inside and outside a docker machine? and here: Identity Server 4 and docker. However the answers have not helped so far.










share|improve this question














I am trying to get an MVC Core Web application to work with Identity Server and Docker. Here are the steps I have taken:



1) Download the quickstart: https://github.com/IdentityServer/IdentityServer4.Samples/tree/dev



Run the project and see it working as expected. Now try adding Docker to the equation:



2) Open the solution. Right click on: IdentityServerWithAspNetIdentity and select: Add Container Orchestration Support (Then Docker Compose, then Linux).
3) Right click on MVCClient and select: Add Container Orchestration Support (Then Docker Compose, then Linux).
4) Change Docker-compose.override.yml to this (note that I only changed the ports for each service from 80 to 5002:80 and 5000:80):



version: '3.4'

services:
mvcclient:
environment:
- ASPNETCORE_ENVIRONMENT=Development
ports:
- "5002:80"

identityserverwithaspnetidentity:
environment:
- ASPNETCORE_ENVIRONMENT=Development
ports:
- "5000:80"


5) Try running the project to see what happens. When I attempt to access: Home/Secure; instead of being forwarded to the login webpage; I see this error: 'Unable to obtain configuration from:http://localhost:5000/.well-known/openid-configuration'.



I believe this is because the Docker container cannot see localhost:5000. Therefore after reading through a few blog posts; I try this:



6) Open startup in the MVCClient and change this:



options.Authority = "http://localhost:5000";


to this:



options.Authority = "http://identityserverwithaspnetidentity:80";


However, I just see a DNS error (404 I believe). What do I need to do to get Identity Server working with an MVC web app in this case?



So far I have looked here: How can I use IdentityServer4 from inside and outside a docker machine? and here: Identity Server 4 and docker. However the answers have not helped so far.







c# asp.net-mvc docker identityserver4






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 25 '18 at 13:42









w0051977w0051977

5,8151276173




5,8151276173













  • Were you able to make this work eventually? I am stuck with the same issue now.

    – Sara
    Jan 14 at 12:50











  • @Sara, yes it is now working as expected. What problem are you having? Have you posted a question?

    – w0051977
    Jan 14 at 14:42



















  • Were you able to make this work eventually? I am stuck with the same issue now.

    – Sara
    Jan 14 at 12:50











  • @Sara, yes it is now working as expected. What problem are you having? Have you posted a question?

    – w0051977
    Jan 14 at 14:42

















Were you able to make this work eventually? I am stuck with the same issue now.

– Sara
Jan 14 at 12:50





Were you able to make this work eventually? I am stuck with the same issue now.

– Sara
Jan 14 at 12:50













@Sara, yes it is now working as expected. What problem are you having? Have you posted a question?

– w0051977
Jan 14 at 14:42





@Sara, yes it is now working as expected. What problem are you having? Have you posted a question?

– w0051977
Jan 14 at 14:42












1 Answer
1






active

oldest

votes


















1














As you already noticed on my thread I had a similar issue. What I did is configuring the following on my IdentityServerAuthenticationOptions (API Side):



1) Set the correct Autority, in your case I would say it should be http://identityserverwithaspnetidentity/

2) Configure the ApiName (this is the name of the ApiResource)

3) Maybe also configure JwtBackChannelHandler (Im not sure if this was required or not)

4) If you are not using Https, I would deactivate it (I don't remember if this is explicitly needed: set RequireHttpsMetadata to false)



And on the client I did the folling



1) Set the ValidateIssuerName to false

2) If you are not using Https, maybe also deactive it by setting RequireHttps to false (I don't remember if this is explicitly needed)






share|improve this answer

























    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53468074%2fintegrating-identity-server-docker-and-mvc-core-web-client%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    1














    As you already noticed on my thread I had a similar issue. What I did is configuring the following on my IdentityServerAuthenticationOptions (API Side):



    1) Set the correct Autority, in your case I would say it should be http://identityserverwithaspnetidentity/

    2) Configure the ApiName (this is the name of the ApiResource)

    3) Maybe also configure JwtBackChannelHandler (Im not sure if this was required or not)

    4) If you are not using Https, I would deactivate it (I don't remember if this is explicitly needed: set RequireHttpsMetadata to false)



    And on the client I did the folling



    1) Set the ValidateIssuerName to false

    2) If you are not using Https, maybe also deactive it by setting RequireHttps to false (I don't remember if this is explicitly needed)






    share|improve this answer






























      1














      As you already noticed on my thread I had a similar issue. What I did is configuring the following on my IdentityServerAuthenticationOptions (API Side):



      1) Set the correct Autority, in your case I would say it should be http://identityserverwithaspnetidentity/

      2) Configure the ApiName (this is the name of the ApiResource)

      3) Maybe also configure JwtBackChannelHandler (Im not sure if this was required or not)

      4) If you are not using Https, I would deactivate it (I don't remember if this is explicitly needed: set RequireHttpsMetadata to false)



      And on the client I did the folling



      1) Set the ValidateIssuerName to false

      2) If you are not using Https, maybe also deactive it by setting RequireHttps to false (I don't remember if this is explicitly needed)






      share|improve this answer




























        1












        1








        1







        As you already noticed on my thread I had a similar issue. What I did is configuring the following on my IdentityServerAuthenticationOptions (API Side):



        1) Set the correct Autority, in your case I would say it should be http://identityserverwithaspnetidentity/

        2) Configure the ApiName (this is the name of the ApiResource)

        3) Maybe also configure JwtBackChannelHandler (Im not sure if this was required or not)

        4) If you are not using Https, I would deactivate it (I don't remember if this is explicitly needed: set RequireHttpsMetadata to false)



        And on the client I did the folling



        1) Set the ValidateIssuerName to false

        2) If you are not using Https, maybe also deactive it by setting RequireHttps to false (I don't remember if this is explicitly needed)






        share|improve this answer















        As you already noticed on my thread I had a similar issue. What I did is configuring the following on my IdentityServerAuthenticationOptions (API Side):



        1) Set the correct Autority, in your case I would say it should be http://identityserverwithaspnetidentity/

        2) Configure the ApiName (this is the name of the ApiResource)

        3) Maybe also configure JwtBackChannelHandler (Im not sure if this was required or not)

        4) If you are not using Https, I would deactivate it (I don't remember if this is explicitly needed: set RequireHttpsMetadata to false)



        And on the client I did the folling



        1) Set the ValidateIssuerName to false

        2) If you are not using Https, maybe also deactive it by setting RequireHttps to false (I don't remember if this is explicitly needed)







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Nov 25 '18 at 18:20

























        answered Nov 25 '18 at 18:15









        BidouBidou

        3,61352856




        3,61352856






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53468074%2fintegrating-identity-server-docker-and-mvc-core-web-client%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Contact image not getting when fetch all contact list from iPhone by CNContact

            count number of partitions of a set with n elements into k subsets

            A CLEAN and SIMPLE way to add appendices to Table of Contents and bookmarks