6 Adding robust SSO security with a Keycloak container
This chapter covers
- The fundamentals of Docker containers
- Integrating containers with .NET Aspire
- Enabling SSO security via a Keycloak container
- Connecting Aspire to external containerization environments
In the previous chapter, we discussed enabling single sign-on authentication in .NET Aspire. This time, you will learn how to do it using a Keycloak container. This chapter serves two purposes:
- Teaching you how to host Docker containers inside a distributed .NET app
- Introducing you to Keycloak (if you aren’t familiar with it already)
To host Keycloak in Aspire, there is an easier way available than hosting a Docker container directly. We can also do it via a special Keycloak component, which provides an Aspire-specific wrapper library for the container and makes it easier to configure and consume.
However, not all services will be available as Aspire components. Knowing how to host containers directly is a useful skill. This is why we will still host Keycloak as a raw Docker container.
We will cover Aspire components from the next chapter onwards. In the meantime, if you want to learn more about the Keycloak component, there is a link in the Further Reading section at the end of this chapter you can follow.