Skip to content
Snippets Groups Projects
FrontendEnvironmentController.java 1.05 KiB
Newer Older
  • Learn to ignore specific revisions
  • import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.*;
    
    
    import org.springframework.web.bind.annotation.GetMapping;
    import org.springframework.web.bind.annotation.RequestMapping;
    import org.springframework.web.bind.annotation.RestController;
    
    import de.ozgcloud.admin.RootController;
    
    import lombok.RequiredArgsConstructor;
    
    @RequestMapping(FrontendEnvironmentController.PATH)
    
    	static final String PATH = "/api/frontendEnvironment"; // NOSONAR
    
    	private final ProductionProperties environmentProperties;
    
    	private final OAuth2Properties oAuthProperties;
    
    
    	@GetMapping
    	public FrontendEnvironment getEnvironment() {
    		return FrontendEnvironment.builder()
    
    				.production(environmentProperties.isProduction())
    				.remoteHost(linkTo(RootController.class).toUri().toString())
    
    				.authServer(oAuthProperties.getAuthServerUrl())
    				.realm(oAuthProperties.getRealm())
    				.clientId(oAuthProperties.getResource())