How to integrate saml to your springboot application with jumpcloud as the idp

106 Views Asked by At

We would like to add one of our internal apps to jumpcloud (we use jumpcloud as our exisiting IDP to login to different services like MS-Office). now to add the internal app to it I firstly am doing a proof-of-concept with a dummy springboot application. I added the following this to spring boot app.

application.properties:


`spring.security.saml2.relyingparty.registration.jumpcloud.assertingparty.metadata-uri=https://sso.jumpcloud.com/saml2/metadata/64b663a87f16d2qwertyuky234`

this url is the metdata url given by jumpcloud to Controller:

`@RestController("/saml")
@Slf4j
public class HomeController {

    @GetMapping("/something")
    public String home(@AuthenticationPrincipal Saml2AuthenticatedPrincipal principal, Model model) {

        model.addAttribute("name", principal.getName());
        model.addAttribute("emailAddress", principal.getFirstAttribute("email"));
        model.addAttribute("userAttributes", principal.getAttributes());
        log.info(model.toString());
        return "home";
 }`

pom.xml:


    `<dependency>
        <groupId>org.springframework.security</groupId>
        <artifactId>spring-security-saml2-service-provider</artifactId>
        <version>6.1.1</version>
    </dependency>

    <dependency>
        <groupId>org.opensaml</groupId>
        <artifactId>opensaml-core</artifactId>
        <version>4.1.1</version>
    </dependency>
    <dependency>
        <groupId>org.opensaml</groupId>
        <artifactId>opensaml-saml-api</artifactId>
        <version>4.1.1</version>
    </dependency>`

Main SpringbootApplication

`package com.saml.ssoDemo;

import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class ssoDemo {

    public static void main(String[] args) {
        SpringApplication.run(OktaSsoApplication.class, args);
    }

}`

JUMPCLOUD CONFIGURATIONS: I logged in from my admin account>selected SSO>selected custom SAML app>Added the following settings>

SP and IDP config ACS URL(the url which it should redirect me to as soon as it authenticates me)

AND HERE IS THE IDP url jumpcloud generated: IDP URL

However when i load up the app it and put in the credentials it redirects me in a loop to the IDP url. enter image description here

0

There are 0 best solutions below