Announcement Announcement Module
Collapse
No announcement yet.
What is the best way to update my custom token? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • What is the best way to update my custom token?

    Hi,

    I manually authenticate user and create token for my services

    Code:
    ...
    Authentication authentication = new UsernamePasswordAuthenticationToken(principal, null, grantedPermissions);
    		
    SecurityContextHolder.getContext().setAuthentication(authentication);
    ServiceFactory.get(ITokenManager.class).add(token);
    And I need to update my token on each request, because the expiration time of token must be equal to session expiration timeout.

    My configuration
    HTML Code:
    	<http auto-config="true" use-expressions="true">
    		<intercept-url pattern="/secured/**" access="isAuthenticated()" />
    		<intercept-url pattern="/**" access="permitAll" />		
    		<form-login login-page="/signin" />
            	<logout logout-success-url="/" delete-cookies="JSESSIONID" />
            	<session-management></session-management>
    	</http>
    	
        <authentication-manager></authentication-manager>
    So, what is the best way to update my service token?

    Thanks!

  • #2
    Sorry, but I don't understand the connection between your tokens and Spring Security. You'll need to explain in more detail what you're trying to achieve.

    Comment


    • #3
      Hi, I need some event or filter where I can update expiration date of my token.
      I can update my token in every action of the controller, but I want to update it in one place. It is possible?

      Comment

      Working...
      X