{"id":259,"date":"2023-01-02T14:18:50","date_gmt":"2023-01-02T14:18:50","guid":{"rendered":"https:\/\/valerio.nu\/?p=259"},"modified":"2023-01-04T19:44:46","modified_gmt":"2023-01-04T19:44:46","slug":"handling-persistency-using-spring-security","status":"publish","type":"post","link":"https:\/\/valerio.nu\/index.php\/2023\/01\/02\/handling-persistency-using-spring-security\/","title":{"rendered":"Handling persistency using Spring Security"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\"><strong>Introduction<\/strong><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">This tutorial will demonstrate how persistence is handled using Spring Security. We will implement a login system with a remember-me feature that shows how Spring Security handles data persistence.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Program Setup\/Prerequisites<\/strong><\/h2>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Spring Boot 2.x;<\/li>\n\n\n\n<li>Spring Security;<\/li>\n\n\n\n<li>JPA;<\/li>\n\n\n\n<li>Thymeleaf;<\/li>\n\n\n\n<li>Database (MySQL).<\/li>\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Database Creation<\/strong><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Our database implementation supports MySQL but you can use any database of your choice provided there is an in-depth understanding of the documentation for your chosen database. Spring JPA was adopted for the query logic. The entities covered by our application include:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>User Entity;<\/li>\n\n\n\n<li>Roles Entity which will serve as authorization;&nbsp;<\/li>\n\n\n\n<li>A pivot table binding users and roles together.<\/li>\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Application implementation<\/strong><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The implementation followed a well-defined separation of concern with Data Access Logic separated from the Presentation Layer.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Defining our Data Source<\/strong><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The connection to the database was saved in application.properties. This contained all needed Hibernate properties and controls. Further documentation on some of the properties used in our application.properties file is available online on the Spring Boot page.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"624\" height=\"1024\" src=\"https:\/\/valerio.nu\/wp-content\/uploads\/2023\/01\/persistenceimg-1-624x1024.png\" alt=\"\" class=\"wp-image-263\" srcset=\"https:\/\/valerio.nu\/wp-content\/uploads\/2023\/01\/persistenceimg-1-624x1024.png 624w, https:\/\/valerio.nu\/wp-content\/uploads\/2023\/01\/persistenceimg-1-183x300.png 183w, https:\/\/valerio.nu\/wp-content\/uploads\/2023\/01\/persistenceimg-1-768x1260.png 768w, https:\/\/valerio.nu\/wp-content\/uploads\/2023\/01\/persistenceimg-1-936x1536.png 936w, https:\/\/valerio.nu\/wp-content\/uploads\/2023\/01\/persistenceimg-1.png 1035w\" sizes=\"auto, (max-width: 624px) 100vw, 624px\" \/><figcaption class=\"wp-element-caption\">our project structure<\/figcaption><\/figure>\n\n\n\n<pre class=\"wp-block-code\"><code>jdbc.driverClassName=com.mysql.jdbc.Driver\njdbc.url=jdbc:mysql:\/\/localhost:3306\/persistenceDB?createDatabaseIfNotExist=true\njdbc.username=your choice\njdbc.password=your choice\n\nspring.jpa.database=mysql\nspring.jpa.hibernate.ddl-auto=update\nspring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL57Dialect\nhibernate.show_sql=false\nspring.main.allow-circular-references=true\nserver.servlet.register-default-servlet = true<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Bean Component Configuration<\/strong><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">To include the data source, we simply apply the @Configuration annotation and set the @PropertySource annotation value to our database property file.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>package com.valerio.userpersistency.springconfig.configImpl;\n\nimport org.springframework.beans.factory.annotation.Autowired;\nimport org.springframework.context.annotation.Bean;\nimport org.springframework.context.annotation.Configuration;\nimport org.springframework.core.env.Environment;\nimport org.springframework.jdbc.datasource.DriverManagerDataSource;\n\nimport javax.sql.DataSource;\n\n@Configuration\npublic class DataSourceConfig {\n    @Autowired\n    Environment env;\n\n    @Bean(value = \"dataSource\")\n    public DataSource getDataSource() {\n        final DriverManagerDataSource dataSource = new DriverManagerDataSource();\n        dataSource.setDriverClassName(env.getProperty(\"jdbc.driverClassName\"));\n        dataSource.setUrl(env.getProperty(\"jdbc.url\"));\n        dataSource.setUsername(env.getProperty(\"jdbc.username\"));\n        dataSource.setPassword(env.getProperty(\"jdbc.password\"));\n        return dataSource;\n    }\n}\n\n<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Configuring our Spring Security<\/strong><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Using the filter chain approach for URL, we can setup a flow that ensures validation is in place. Our approach in this tutorial is simple and easy to follow:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong><em>Using the WebSecurityConfigurerAdapter<\/em><\/strong>. Here, we extended the WebSecurityConfigurerAdapter so as to have access to the associated method.\u00a0 The User detail was <a href=\"https:\/\/docs.spring.io\/spring-framework\/docs\/3.0.x\/javadoc-api\/org\/springframework\/beans\/factory\/annotation\/Autowired.html\">autowired<\/a>, providing a dependency injection access. Remember that our focus is to ensure persistence, hence, we created the rememberme configuration alongside the persistence token. The PersistentTokenRepository is called to work with our custom persistence token setup. This handshake ensures that tokens are dynamically generated. We further implemented a means to save generated tokens in our database when rememberMe button is checked by the user.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>@Configuration\n@EnableWebSecurity\n@PropertySource(\"classpath:application.properties\")\npublic class SecurityConfig extends WebSecurityConfigurerAdapter {\n\n    @Autowired\n    @Qualifier(\"userDetailsService\")\n    private UserDetailsService userDetailsService;\n\n    @Autowired\n    @Qualifier(\"authenticationSuccessHandler\")\n    private AuthenticationSuccessHandler authenticationSuccessHandler;\n\n    @Override\n    protected void configure(HttpSecurity http) throws Exception {\n        http.authorizeRequests()\n                .antMatchers(\"\/persistence\", \"\/persistence\/accessDenied\").permitAll()\n                .and().exceptionHandling().accessDeniedPage(\"\/persistence\/accessDenied\")\n                .and().csrf().disable();\n\n        \/\/ two variants of AuthorizedUrl configuration was done here\n        http.authorizeRequests()\n                .antMatchers(\"\/persistence\/homepage\/Dashboard\/**\").access(\"hasRole('ADMIN')\");\n        http.authorizeRequests()\n                .antMatchers(\"\/persistence\/homepage\/user\/**\", \"\/persistence\/redirect\").hasRole(\"USER\");  \/\/ \"ROLE_\" adds automatically\n\n        \/\/login configuration was done here\n        http.formLogin()\n                .loginPage(\"\/persistence\")\n                .loginProcessingUrl(\"\/loginFormPostTo\")\n                .usernameParameter(\"myLoginPageUsernameParameterName\")\n                .passwordParameter(\"myLoginPagePasswordParameterName\")\n                .successHandler(authenticationSuccessHandler);\n\n        \/\/remember me configuration was done here\n        http.rememberMe()\n                .tokenRepository(persistentTokenRepository())\n                .rememberMeParameter(\"myRememberMeParameterName\")\n                .rememberMeCookieName(\"my-remember-me\")\n                .tokenValiditySeconds(86400);\n\n        \/\/logout configuration was done here\n        http.logout()\n                .logoutUrl(\"\/Logout\")\n                .logoutSuccessUrl(\"\/persistence\");\n\n        http.sessionManagement().maximumSessions(1);\n    }\n\n    @Autowired\n    public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {\n        auth.userDetailsService(userDetailsService).passwordEncoder(getPasswordEncoder());\n    }\n\n    @Bean(value = \"passwordEncoder\")\n    public PasswordEncoder getPasswordEncoder() {\n        return new BCryptPasswordEncoder(7);\n    }\n\n    @Autowired\n    @Qualifier(\"dataSource\")\n    DataSource dataSource;\n\n    @Bean\n    public PersistentTokenRepository persistentTokenRepository() {\n        CustomJdbcTokenImpl tokenRepository = new CustomJdbcTokenImpl();\n        tokenRepository.setDataSource(dataSource);\n        return tokenRepository;\n    }\n}\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Application Success Authentication Handler<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">This interface is used to implement successful authentication redirection. It is called by using the onAuthenticationSuccess method. Redirection to the success or authorised page occurs when the user authentication is successful.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>@Component(\"authenticationSuccessHandler\")\npublic class SuccessAuthenticationHandler  implements AuthenticationSuccessHandler {\n\n    private final Logger logger = LoggerFactory.getLogger(SuccessAuthenticationHandler.class);\n\n    private RedirectStrategy redirectStrategy = new DefaultRedirectStrategy();\n    @Override\n    public void onAuthenticationSuccess(HttpServletRequest request,\n                                        HttpServletResponse response,\n                                        Authentication authentication) throws IOException, ServletException {\n\n        String targetUrl = null;\n        Supplier&lt;Stream&lt;? extends GrantedAuthority&gt;&gt; sup = () -&gt; authentication.getAuthorities().stream();\n\n        if(sup.get().anyMatch(a-&gt;(((GrantedAuthority) a).getAuthority().equals(\"ROLE_ADMIN\")))) {\n            targetUrl = \"\/persistence\/homepage\/Dashboard\";\n        } else if(sup.get().anyMatch(a-&gt;(((GrantedAuthority) a).getAuthority().equals(\"ROLE_USER\")))) {\n            targetUrl = \"\/persistence\/homepage\/user\";\n        } else {\n            targetUrl = \"\/persistence\";\n        }\n\n        redirectStrategy.sendRedirect(request, response, targetUrl);\n\n        final HttpSession session = request.getSession(false);\n        if (session != null) {\n            \/\/ inactive interval in minutes between client requests before the servlet container will invalidate this session\n            session.setMaxInactiveInterval(10 * 60);\n            session.removeAttribute(WebAttributes.AUTHENTICATION_EXCEPTION);\n        }\n    }\n}<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Other implementations<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">In this tutorial, we implemented several spring features such as userRepository to handle everything that concern user access. Role management was carried out using the roleRepository service. To handle our static files, WebMvcConfigurer interface implementation enable us to override addResourceHandlers method. This method provides means to access static file saved in the resources folder.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Conclusion<\/strong><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">We have demonstrated how to handle persistence using Spring Security. Complete source code implementation for this project can be found on our <a href=\"https:\/\/github.com\/valerio-nu\/userpersistency\">GitHub page<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Introduction This tutorial will demonstrate how persistence is handled using Spring Security. We will implement a login system with a remember-me feature that shows how [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11,23],"tags":[27,26,28],"class_list":["post-259","post","type-post","status-publish","format-standard","hentry","category-java","category-spring-security","tag-persistence","tag-spring-security","tag-user-login"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.6 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Handling persistency using Spring Security - Andy&#039;s blog \u2935\ufe0f<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/valerio.nu\/index.php\/2023\/01\/02\/handling-persistency-using-spring-security\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Handling persistency using Spring Security - Andy&#039;s blog \u2935\ufe0f\" \/>\n<meta property=\"og:description\" content=\"Introduction This tutorial will demonstrate how persistence is handled using Spring Security. We will implement a login system with a remember-me feature that shows how [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/valerio.nu\/index.php\/2023\/01\/02\/handling-persistency-using-spring-security\/\" \/>\n<meta property=\"og:site_name\" content=\"Andy&#039;s blog \u2935\ufe0f\" \/>\n<meta property=\"article:published_time\" content=\"2023-01-02T14:18:50+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-01-04T19:44:46+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/valerio.nu\/wp-content\/uploads\/2023\/01\/persistenceimg-1-624x1024.png\" \/>\n<meta name=\"author\" content=\"andy\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"andy\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/valerio.nu\\\/index.php\\\/2023\\\/01\\\/02\\\/handling-persistency-using-spring-security\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/valerio.nu\\\/index.php\\\/2023\\\/01\\\/02\\\/handling-persistency-using-spring-security\\\/\"},\"author\":{\"name\":\"andy\",\"@id\":\"https:\\\/\\\/valerio.nu\\\/#\\\/schema\\\/person\\\/da69cc3da309893b0d3bc8fcef75f128\"},\"headline\":\"Handling persistency using Spring Security\",\"datePublished\":\"2023-01-02T14:18:50+00:00\",\"dateModified\":\"2023-01-04T19:44:46+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/valerio.nu\\\/index.php\\\/2023\\\/01\\\/02\\\/handling-persistency-using-spring-security\\\/\"},\"wordCount\":433,\"commentCount\":1,\"image\":{\"@id\":\"https:\\\/\\\/valerio.nu\\\/index.php\\\/2023\\\/01\\\/02\\\/handling-persistency-using-spring-security\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/valerio.nu\\\/wp-content\\\/uploads\\\/2023\\\/01\\\/persistenceimg-1-624x1024.png\",\"keywords\":[\"persistence\",\"Spring security\",\"user login\"],\"articleSection\":[\"Java\",\"Spring Security\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/valerio.nu\\\/index.php\\\/2023\\\/01\\\/02\\\/handling-persistency-using-spring-security\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/valerio.nu\\\/index.php\\\/2023\\\/01\\\/02\\\/handling-persistency-using-spring-security\\\/\",\"url\":\"https:\\\/\\\/valerio.nu\\\/index.php\\\/2023\\\/01\\\/02\\\/handling-persistency-using-spring-security\\\/\",\"name\":\"Handling persistency using Spring Security - Andy&#039;s blog \u2935\ufe0f\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/valerio.nu\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/valerio.nu\\\/index.php\\\/2023\\\/01\\\/02\\\/handling-persistency-using-spring-security\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/valerio.nu\\\/index.php\\\/2023\\\/01\\\/02\\\/handling-persistency-using-spring-security\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/valerio.nu\\\/wp-content\\\/uploads\\\/2023\\\/01\\\/persistenceimg-1-624x1024.png\",\"datePublished\":\"2023-01-02T14:18:50+00:00\",\"dateModified\":\"2023-01-04T19:44:46+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/valerio.nu\\\/#\\\/schema\\\/person\\\/da69cc3da309893b0d3bc8fcef75f128\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/valerio.nu\\\/index.php\\\/2023\\\/01\\\/02\\\/handling-persistency-using-spring-security\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/valerio.nu\\\/index.php\\\/2023\\\/01\\\/02\\\/handling-persistency-using-spring-security\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/valerio.nu\\\/index.php\\\/2023\\\/01\\\/02\\\/handling-persistency-using-spring-security\\\/#primaryimage\",\"url\":\"https:\\\/\\\/valerio.nu\\\/wp-content\\\/uploads\\\/2023\\\/01\\\/persistenceimg-1.png\",\"contentUrl\":\"https:\\\/\\\/valerio.nu\\\/wp-content\\\/uploads\\\/2023\\\/01\\\/persistenceimg-1.png\",\"width\":1035,\"height\":1698},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/valerio.nu\\\/index.php\\\/2023\\\/01\\\/02\\\/handling-persistency-using-spring-security\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/valerio.nu\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Handling persistency using Spring Security\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/valerio.nu\\\/#website\",\"url\":\"https:\\\/\\\/valerio.nu\\\/\",\"name\":\"Andy&#039;s blog \u2935\ufe0f\",\"description\":\"Abandon all hope, ye who enter here\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/valerio.nu\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/valerio.nu\\\/#\\\/schema\\\/person\\\/da69cc3da309893b0d3bc8fcef75f128\",\"name\":\"andy\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/4852a025c6250c852814d4017f646677730a23c1ec14eb5ca36b69dcce5135a5?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/4852a025c6250c852814d4017f646677730a23c1ec14eb5ca36b69dcce5135a5?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/4852a025c6250c852814d4017f646677730a23c1ec14eb5ca36b69dcce5135a5?s=96&d=mm&r=g\",\"caption\":\"andy\"},\"sameAs\":[\"https:\\\/\\\/valerio.nu\"],\"url\":\"https:\\\/\\\/valerio.nu\\\/index.php\\\/author\\\/giuseppe\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Handling persistency using Spring Security - Andy&#039;s blog \u2935\ufe0f","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/valerio.nu\/index.php\/2023\/01\/02\/handling-persistency-using-spring-security\/","og_locale":"en_US","og_type":"article","og_title":"Handling persistency using Spring Security - Andy&#039;s blog \u2935\ufe0f","og_description":"Introduction This tutorial will demonstrate how persistence is handled using Spring Security. We will implement a login system with a remember-me feature that shows how [&hellip;]","og_url":"https:\/\/valerio.nu\/index.php\/2023\/01\/02\/handling-persistency-using-spring-security\/","og_site_name":"Andy&#039;s blog \u2935\ufe0f","article_published_time":"2023-01-02T14:18:50+00:00","article_modified_time":"2023-01-04T19:44:46+00:00","og_image":[{"url":"https:\/\/valerio.nu\/wp-content\/uploads\/2023\/01\/persistenceimg-1-624x1024.png","type":"","width":"","height":""}],"author":"andy","twitter_card":"summary_large_image","twitter_misc":{"Written by":"andy","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/valerio.nu\/index.php\/2023\/01\/02\/handling-persistency-using-spring-security\/#article","isPartOf":{"@id":"https:\/\/valerio.nu\/index.php\/2023\/01\/02\/handling-persistency-using-spring-security\/"},"author":{"name":"andy","@id":"https:\/\/valerio.nu\/#\/schema\/person\/da69cc3da309893b0d3bc8fcef75f128"},"headline":"Handling persistency using Spring Security","datePublished":"2023-01-02T14:18:50+00:00","dateModified":"2023-01-04T19:44:46+00:00","mainEntityOfPage":{"@id":"https:\/\/valerio.nu\/index.php\/2023\/01\/02\/handling-persistency-using-spring-security\/"},"wordCount":433,"commentCount":1,"image":{"@id":"https:\/\/valerio.nu\/index.php\/2023\/01\/02\/handling-persistency-using-spring-security\/#primaryimage"},"thumbnailUrl":"https:\/\/valerio.nu\/wp-content\/uploads\/2023\/01\/persistenceimg-1-624x1024.png","keywords":["persistence","Spring security","user login"],"articleSection":["Java","Spring Security"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/valerio.nu\/index.php\/2023\/01\/02\/handling-persistency-using-spring-security\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/valerio.nu\/index.php\/2023\/01\/02\/handling-persistency-using-spring-security\/","url":"https:\/\/valerio.nu\/index.php\/2023\/01\/02\/handling-persistency-using-spring-security\/","name":"Handling persistency using Spring Security - Andy&#039;s blog \u2935\ufe0f","isPartOf":{"@id":"https:\/\/valerio.nu\/#website"},"primaryImageOfPage":{"@id":"https:\/\/valerio.nu\/index.php\/2023\/01\/02\/handling-persistency-using-spring-security\/#primaryimage"},"image":{"@id":"https:\/\/valerio.nu\/index.php\/2023\/01\/02\/handling-persistency-using-spring-security\/#primaryimage"},"thumbnailUrl":"https:\/\/valerio.nu\/wp-content\/uploads\/2023\/01\/persistenceimg-1-624x1024.png","datePublished":"2023-01-02T14:18:50+00:00","dateModified":"2023-01-04T19:44:46+00:00","author":{"@id":"https:\/\/valerio.nu\/#\/schema\/person\/da69cc3da309893b0d3bc8fcef75f128"},"breadcrumb":{"@id":"https:\/\/valerio.nu\/index.php\/2023\/01\/02\/handling-persistency-using-spring-security\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/valerio.nu\/index.php\/2023\/01\/02\/handling-persistency-using-spring-security\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/valerio.nu\/index.php\/2023\/01\/02\/handling-persistency-using-spring-security\/#primaryimage","url":"https:\/\/valerio.nu\/wp-content\/uploads\/2023\/01\/persistenceimg-1.png","contentUrl":"https:\/\/valerio.nu\/wp-content\/uploads\/2023\/01\/persistenceimg-1.png","width":1035,"height":1698},{"@type":"BreadcrumbList","@id":"https:\/\/valerio.nu\/index.php\/2023\/01\/02\/handling-persistency-using-spring-security\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/valerio.nu\/"},{"@type":"ListItem","position":2,"name":"Handling persistency using Spring Security"}]},{"@type":"WebSite","@id":"https:\/\/valerio.nu\/#website","url":"https:\/\/valerio.nu\/","name":"Andy&#039;s blog \u2935\ufe0f","description":"Abandon all hope, ye who enter here","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/valerio.nu\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/valerio.nu\/#\/schema\/person\/da69cc3da309893b0d3bc8fcef75f128","name":"andy","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/4852a025c6250c852814d4017f646677730a23c1ec14eb5ca36b69dcce5135a5?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/4852a025c6250c852814d4017f646677730a23c1ec14eb5ca36b69dcce5135a5?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/4852a025c6250c852814d4017f646677730a23c1ec14eb5ca36b69dcce5135a5?s=96&d=mm&r=g","caption":"andy"},"sameAs":["https:\/\/valerio.nu"],"url":"https:\/\/valerio.nu\/index.php\/author\/giuseppe\/"}]}},"_links":{"self":[{"href":"https:\/\/valerio.nu\/index.php\/wp-json\/wp\/v2\/posts\/259","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/valerio.nu\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/valerio.nu\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/valerio.nu\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/valerio.nu\/index.php\/wp-json\/wp\/v2\/comments?post=259"}],"version-history":[{"count":11,"href":"https:\/\/valerio.nu\/index.php\/wp-json\/wp\/v2\/posts\/259\/revisions"}],"predecessor-version":[{"id":274,"href":"https:\/\/valerio.nu\/index.php\/wp-json\/wp\/v2\/posts\/259\/revisions\/274"}],"wp:attachment":[{"href":"https:\/\/valerio.nu\/index.php\/wp-json\/wp\/v2\/media?parent=259"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/valerio.nu\/index.php\/wp-json\/wp\/v2\/categories?post=259"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/valerio.nu\/index.php\/wp-json\/wp\/v2\/tags?post=259"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}