Announcement Announcement Module
Collapse
No announcement yet.
Need Help Regarding Authentication related conditional Text in JSP Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Need Help Regarding Authentication related conditional Text in JSP

    Hello Friends,

    Please Refer code snippet in index.jsp

    <c:if test="${empty param.secu_msg}">
    <span style="color:#0066FF;font-family:Tahoma;font-size:16px;">
    <strong>Please Enter UserName Password To Login</strong>
    </span>
    </c:if>

    What I want to do is If user is already logged in then I want to display "Currently logged in user is <username>"
    otherwise the above message.

    Please guide me in this respect.

    thanks and warm regards.

    Raja

    To get an Idea the part of Spring-Security-config.xml is as follows.

    <security:http access-decision-manager-ref="applicationAccessManager"
    access-denied-page="/index.jsp?secu_msg=access_denied">

    <security:intercept-url pattern="/spring/messagebroker/**" access="ROLE_ANONYMOUS"/>

    <security:intercept-url pattern="/WEB-Flex/FA-Module.jsp" access="ROLE_SR_MGR"/>
    <security:intercept-url pattern="/WEB-Flex/**" access="ROLE_AUTHENTICATED"/>
    <security:intercept-url pattern="/utility/**" access="ROLE_AUTHENTICATED"/>
    <security:intercept-url pattern="/temp/**" access="ROLE_AUTHENTICATED"/>
    <security:intercept-url pattern="/reports/**" access="ROLE_AUTHENTICATED"/>
    <security:intercept-url pattern="/**" access="ROLE_AUTHENTICATED"/>

    <security:form-login login-page="/index.jsp?secu_msg=login_needed"
    default-target-url="/index.jsp?secu_msg=login_success"
    authentication-failure-url="/index.jsp?secu_msg=login_failed"
    />

    <security:logout logout-success-url="/index.jsp?secu_msg=logged_out" invalidate-session="true" />

    <security:session-management invalid-session-url="/index.jsp?secu_msg=invalid_session"
    session-fixation-protection="migrateSession">
    <security:concurrency-control
    max-sessions="100"
    error-if-maximum-exceeded="true"
    expired-url="/index.jsp?secu_msg=session_expired"
    session-registry-ref="sessionRegistry"
    />
    </security:session-management>

    </security:http>

  • #2
    Hi Raja

    UserName you can get it from SecurityContextHolder, and Spring Security tag also provides same, so you can check on that bases and if its null show your message

    Comment

    Working...
    X