package org.appverse.web.framework.backend.frontfacade.mvc.swagger.controller;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

@Controller
@RequestMapping("/swaggeroauth2login")
public class SwaggerOAuth2LoginController {
	
	@Value("${appverse.frontfacade.swagger.oauth2.clientId}")
	private String swaggerClientId;
	
	@Value("${appverse.frontfacade.rest.api.basepath:/api}")
	private String apiBasePath;
	
	@Value("${appverse.frontfacade.oauth2.loginEndpoint.path:/sec/login}")
	private String oauth2LoginEndpoint;	
	
	@RequestMapping(method = RequestMethod.GET)
	public String showSwaggerOAuth2LoginForm(Model model) {
		model.addAttribute("swaggerLoginFormAction", apiBasePath + oauth2LoginEndpoint);
		model.addAttribute("swaggerClientId", swaggerClientId);
		model.addAttribute("swaggerRedirectUri", "/o2c.html");		
		return "oauth2loginform";
	}
}
@@ -132,16 +132,95 @@
 .Value;%0A
+import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;%0A
 import o
@@ -475,16 +475,120 @@
 login%22)%0A
+@ConditionalOnProperty(value=%22appverse.frontfacade.oauth2.apiprotection.enabled%22, matchIfMissing=false)%0A
 public c

fix startup Swagger oauth2 controller on non-oauth projects