'acegi'에 해당되는 글 1건


Acegi 0.8 이전버전에서 사용되는 로직

 

로그인을 거쳐 인증되지 않은 사용자인 경우에는 로그인 페이지로 이동하라 는 문장

<c:if test="${empty ACEGI_SECURITY_AUTHENTICATION.principal.username}">
<script language="javascript" >
 top.location.replace("/qis/acegilogin.jsp"); 
</script>

 

Acegi 0.8 이후버전에서 사용되는 변경로직

<c:if test="${empty ACEGI_SECURITY_CONTEXT.authentication.principal.username}">
<script language="javascript" >
 top.location.replace("/qis/acegilogin.jsp"); 
</script>

 

인증객체를 변수에 담아서 사용하는 방법

<c:set var="authentication" value="${sessionScope['ACEGI_SECURITY_CONTEXT'].authentication}"/>
<c:set var="userName" value="${authentication.principal.username}"/>

다른방법 2

<%= SecurityContextHolder.getContext().getAuthentication().getName() %>


블로그 이미지

희망잡이

,