{"id":16541637,"url":"https://github.com/itzg/spring-security-spa","last_synced_at":"2026-04-27T18:05:08.724Z","repository":{"id":145318034,"uuid":"125689070","full_name":"itzg/spring-security-spa","owner":"itzg","description":"Provides Spring Security filters and supporting classes that streamline the use of authentication and registration within Single Page web Applications","archived":false,"fork":false,"pushed_at":"2018-06-10T14:50:55.000Z","size":72,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-12-19T13:20:22.624Z","etag":null,"topics":["spring-mvc","spring-security"],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/itzg.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-03-18T03:21:59.000Z","updated_at":"2020-06-29T04:49:47.000Z","dependencies_parsed_at":null,"dependency_job_id":"8c27fc8c-56a6-40a7-8279-dd51e5e0a02e","html_url":"https://github.com/itzg/spring-security-spa","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/itzg/spring-security-spa","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/itzg%2Fspring-security-spa","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/itzg%2Fspring-security-spa/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/itzg%2Fspring-security-spa/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/itzg%2Fspring-security-spa/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/itzg","download_url":"https://codeload.github.com/itzg/spring-security-spa/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/itzg%2Fspring-security-spa/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32348058,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-27T17:12:42.749Z","status":"ssl_error","status_checked_at":"2026-04-27T17:12:41.658Z","response_time":128,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["spring-mvc","spring-security"],"created_at":"2024-10-11T18:55:32.017Z","updated_at":"2026-04-27T18:05:08.708Z","avatar_url":"https://github.com/itzg.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"This library provides Spring Security filters and supporting classes that streamline the use of\nauthentication and registration within Single Page web Applications (SPA).\n\n## Installation\n\nAdd the jcenter repository to your build, such as\n\n```xml\n\u003crepository\u003e\n  \u003csnapshots\u003e\n    \u003cenabled\u003efalse\u003c/enabled\u003e\n  \u003c/snapshots\u003e\n  \u003cid\u003ejcenter\u003c/id\u003e\n  \u003cname\u003ejcenter\u003c/name\u003e\n  \u003curl\u003ehttps://jcenter.bintray.com\u003c/url\u003e\n\u003c/repository\u003e\n```\n\nand the dependency to this library\n\n```xml\n\u003cdependency\u003e\n  \u003cgroupId\u003eme.itzg\u003c/groupId\u003e\n  \u003cartifactId\u003espring-security-spa\u003c/artifactId\u003e\n  \u003cversion\u003e1.1.0\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\n## Usage\n\nThis library provides a pair Spring Security filters that both accept a JSON payload via a POST:\n* `me.itzg.spring.security.spa.RegistrationFilter`\n* `me.itzg.spring.security.spa.RequestBodyLoginFilter`\n\nThe JSON payload must contain two fields:\n* `username`\n* `password`\n\nThe library also provides `SimpleLogoutSuccessHandler` in order to conclude the logout process with just a 200 OK\nstatus code.\n\nThe registration manager needs a [`UserDetailsManager`][1] in order to add the newly registered user.\nIt also needs a [`PasswordEncoder`][2] to encode the registration's new password. The following example\nshows how to configure the filters in a way that consistently manages those beans between the filters\nand the Spring security layer.\n\n## Example\n\n```java\nimport me.itzg.spring.security.spa.SinglePageAppConfigurer;\nimport me.itzg.spring.security.spa.SimpleLogoutSuccessHandler;\n\n@Configuration\npublic class WebSecurityConfig extends WebSecurityConfigurerAdapter {\n\n    @Override\n    protected void configure(HttpSecurity http) throws Exception {\n        http\n                .authorizeRequests()\n                .anyRequest().fullyAuthenticated()\n\n                .and().logout().logoutSuccessHandler(new SimpleLogoutSuccessHandler())\n                .and().csrf().disable() // CSRF is less helpful (and a little annoying) with single page apps\n\n                .and().apply(new SinglePageAppConfigurer\u003c\u003e()).registerUrl(\"/register/local\").loginUrl(\"/login/local\")\n                ;\n    }\n\n    @Override\n    protected void configure(AuthenticationManagerBuilder auth) throws Exception {\n        auth\n                .userDetailsService(userDetailsManager())\n                .passwordEncoder(passwordEncoder())\n                .and()\n                .inMemoryAuthentication();\n    }\n\n    @Bean\n    public PasswordEncoder passwordEncoder() {\n        return PasswordEncoderFactories.createDelegatingPasswordEncoder();\n    }\n\n    @Bean\n    public UserDetailsManager userDetailsManager() {\n        return new InMemoryUserDetailsManager();\n    }\n}\n```\n\n[1]: https://docs.spring.io/spring-security/site/docs/current/api/org/springframework/security/provisioning/UserDetailsManager.html\n[2]: https://docs.spring.io/spring-security/site/docs/current/api/org/springframework/security/crypto/password/PasswordEncoder.html\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fitzg%2Fspring-security-spa","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fitzg%2Fspring-security-spa","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fitzg%2Fspring-security-spa/lists"}