Spring security, thymeleaf and cookie -


actually, use spring boot, thymeleaf , spring security. security splitted in 2 in application.

one mvc , other 1 rest call.

i search way if login ok create cookie login/password able add header every ajax call.

headers: {     "authorization": "basic " + $.cookie('cookie-authorization') }, 

so search create cookie if login success

edit possible on server side?

you can use code official doc include tokens in ajax calls.

$(function() {     var token = $("meta[name='_csrf']").attr("content");     var header = $("meta[name='_csrf_header']").attr("content");     $(document).ajaxsend(function(e, xhr, options) {         xhr.setrequestheader(header, token);     }); }) 

hope helps.


Comments

Popular posts from this blog

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

python Tkinter Capturing keyboard events save as one single string -

sql server - Why does Linq-to-SQL add unnecessary COUNT()? -