// Path: src/main/java/org/esupportail/papercut/config/EsupPapercutConfig.java
// @Component
// @ConfigurationProperties(prefix="esup")
// @PropertySource(value = "classpath:/esup-papercut.properties", encoding = "UTF-8")
// @EnableGlobalMethodSecurity(prePostEnabled=true)
// public class EsupPapercutConfig {
// 
// 	String defaultContext = null;
// 	
// 	Map<String, EsupPapercutContext> contexts;
// 
// 	public Map<String, EsupPapercutContext> getContexts() {
// 		return contexts;
// 	}
// 
// 	public void setContexts(Map<String, EsupPapercutContext> contexts) {
// 		this.contexts = contexts;
// 	}
// 
// 	public void setDefaultContext(String defaultContext) {
// 		this.defaultContext = defaultContext;
// 	}
// 
// 	public String getDefaultContext() {
// 		List<String> availableContexts = WebUtils.availableContexts();
// 		if(!availableContexts.isEmpty()) {
// 			if(defaultContext != null && availableContexts.contains(defaultContext)) {
// 				return defaultContext;
// 			} else {
// 				return availableContexts.get(0);
// 			}
// 		}
// 		return defaultContext;
// 	}
// 
// 	public EsupPapercutContext getContext(String contextKey) {
// 		return contexts.get(contextKey);
// 	}
// 	
// }


import javax.annotation.Resource;
import org.esupportail.papercut.config.EsupPapercutConfig;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
/**
 * Licensed to EsupPortail under one or more contributor license
 * agreements. See the NOTICE file distributed with this work for
 * additional information regarding copyright ownership.
 *
 * EsupPortail licenses this file to you under the Apache License,
 * Version 2.0 (the "License"); you may not use this file except in
 * compliance with the License. You may obtain a copy of the License at:
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.esupportail.papercut.web;



@Controller
public class IndexController {
		
	@Resource
// Path: src/main/java/org/esupportail/papercut/config/EsupPapercutConfig.java
// @Component
// @ConfigurationProperties(prefix="esup")
// @PropertySource(value = "classpath:/esup-papercut.properties", encoding = "UTF-8")
// @EnableGlobalMethodSecurity(prePostEnabled=true)
// public class EsupPapercutConfig {
// 
// 	String defaultContext = null;
// 	
// 	Map<String, EsupPapercutContext> contexts;
// 
// 	public Map<String, EsupPapercutContext> getContexts() {
// 		return contexts;
// 	}
// 
// 	public void setContexts(Map<String, EsupPapercutContext> contexts) {
// 		this.contexts = contexts;
// 	}
// 
// 	public void setDefaultContext(String defaultContext) {
// 		this.defaultContext = defaultContext;
// 	}
// 
// 	public String getDefaultContext() {
// 		List<String> availableContexts = WebUtils.availableContexts();
// 		if(!availableContexts.isEmpty()) {
// 			if(defaultContext != null && availableContexts.contains(defaultContext)) {
// 				return defaultContext;
// 			} else {
// 				return availableContexts.get(0);
// 			}
// 		}
// 		return defaultContext;
// 	}
// 
// 	public EsupPapercutContext getContext(String contextKey) {
// 		return contexts.get(contextKey);
// 	}
// 	
// }


// Path: src/main/java/org/esupportail/papercut/web/IndexController.java
import javax.annotation.Resource;
import org.esupportail.papercut.config.EsupPapercutConfig;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * Licensed to EsupPortail under one or more contributor license
 * agreements. See the NOTICE file distributed with this work for
 * additional information regarding copyright ownership.
 *
 * EsupPortail licenses this file to you under the Apache License,
 * Version 2.0 (the "License"); you may not use this file except in
 * compliance with the License. You may obtain a copy of the License at:
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.esupportail.papercut.web;



@Controller
public class IndexController {
		
	@Resource
	EsupPapercutConfig config;