spring boot init
spring boot init
This commit is contained in:
@@ -1,57 +0,0 @@
|
||||
package org.maxkey.authn.support.cas;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.jasig.cas.client.util.AbstractCasFilter;
|
||||
import org.jasig.cas.client.validation.Assertion;
|
||||
import org.maxkey.config.ApplicationConfig;
|
||||
import org.maxkey.constants.LOGINTYPE;
|
||||
import org.maxkey.web.WebContext;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
|
||||
/**
|
||||
* @author Crystal.Sea
|
||||
*
|
||||
*/
|
||||
@Controller
|
||||
public class CasEndpoint {
|
||||
private static Logger _logger = LoggerFactory.getLogger(CasEndpoint.class);
|
||||
|
||||
@Autowired
|
||||
@Qualifier("applicationConfig")
|
||||
protected ApplicationConfig applicationConfig;
|
||||
|
||||
|
||||
/**
|
||||
* init login
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value={"/logon/cas"})
|
||||
public ModelAndView casLogin(
|
||||
HttpServletRequest request,
|
||||
HttpServletResponse response) {
|
||||
_logger.debug("CasEndpoint /cas.");
|
||||
|
||||
Assertion assertion = (Assertion) request.getSession().getAttribute(AbstractCasFilter.CONST_CAS_ASSERTION);
|
||||
|
||||
|
||||
String username= assertion.getPrincipal().getName();
|
||||
|
||||
_logger.debug("CAS username : "+username);
|
||||
|
||||
if(WebContext.setAuthentication(username,LOGINTYPE.CAS,"","","success")){
|
||||
|
||||
}
|
||||
|
||||
|
||||
return WebContext.redirect("/login");
|
||||
}
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
package org.maxkey.authn.support.cas;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.security.core.AuthenticationException;
|
||||
import org.springframework.security.web.AuthenticationEntryPoint;
|
||||
|
||||
public class CasEntryPoint implements AuthenticationEntryPoint {
|
||||
|
||||
private static final Logger _logger = LoggerFactory.getLogger(CasEntryPoint.class);
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.springframework.security.web.AuthenticationEntryPoint#commence(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, org.springframework.security.core.AuthenticationException)
|
||||
*/
|
||||
public void commence(HttpServletRequest request, HttpServletResponse response,
|
||||
AuthenticationException ex) throws IOException, ServletException {
|
||||
|
||||
_logger.debug("CasEntryPoint..");
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user