'Protecting a Spring Boot SOAP service with SAML2 using Keycloak

I'm trying to run the servlet/spring-boot/java/saml2/login-single-tenant example from https://github.com/spring-projects/spring-security-samples.git using Keycloak.

I started a local docker Keycloak container in which I created a new realm with the saml identity provider.

When I run the example it connects to keycloak to fetch the /saml/descriptor, which is returned correctly. But then it throws an AccessDeniedException.

I don't know what I'm doing wrong, I don't even know what I should be doing right. Can anybody help me please?

The ultimate goal would be to have a pure machine to machine connection, without login page, protected by SAML.

Ps.: I know about OIDC, but I'm working on a java client that connects to a SOAP webservice that requires a SAML security token.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source