{"id":16513960,"url":"https://github.com/twin/spring-as-backend","last_synced_at":"2025-10-28T04:32:21.940Z","repository":{"id":39927275,"uuid":"137599796","full_name":"TwiN/spring-as-backend","owner":"TwiN","description":"A ready-to-go secure Spring backend","archived":false,"fork":false,"pushed_at":"2024-08-26T16:41:54.000Z","size":105,"stargazers_count":4,"open_issues_count":3,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-01T11:34:43.201Z","etag":null,"topics":["quickstart","spring","spring-boot","spring-framework","spring-security"],"latest_commit_sha":null,"homepage":"https://twinnation.org/articles/23/project-spring-as-backend","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/TwiN.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","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},"funding":{"github":["TwiN"]}},"created_at":"2018-06-16T17:53:26.000Z","updated_at":"2024-08-13T20:17:35.000Z","dependencies_parsed_at":"2024-10-11T16:21:13.624Z","dependency_job_id":null,"html_url":"https://github.com/TwiN/spring-as-backend","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TwiN%2Fspring-as-backend","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TwiN%2Fspring-as-backend/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TwiN%2Fspring-as-backend/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TwiN%2Fspring-as-backend/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TwiN","download_url":"https://codeload.github.com/TwiN/spring-as-backend/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238597386,"owners_count":19498396,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["quickstart","spring","spring-boot","spring-framework","spring-security"],"created_at":"2024-10-11T16:10:58.823Z","updated_at":"2025-10-28T04:32:21.577Z","avatar_url":"https://github.com/TwiN.png","language":"Java","funding_links":["https://github.com/sponsors/TwiN"],"categories":[],"sub_categories":[],"readme":"# spring-as-backend\n\nA ready-to-go secure Spring backend.\n\nThis setup assumes that anybody can access your website, \nbut only specific features are meant to be accessed for authenticated users.\n\nIf you wish to force everything to be only accessible by authenticated users, uncomment the following lines\nin `SecurityConfiguration.java`:\n\n\t.authorizeRequests()\n\t\t.antMatchers(HttpMethod.POST, \"/api/v1/users\").permitAll()\n\t\t.anyRequest().authenticated()\n\t\t.and()\n\t\t\nBy doing so, any request to the API will redirect you to the default [login page](#login) except for:\n \n| Method |     Path      | Justification |\n|:------:|:-------------:|:-------------:|\n| POST   | /api/v1/users |   Register    |\n| POST   | /api/v1/login |    Login      |\n\n\n## Usage with Docker\n\n```\ndocker-compose up\n```\n\n\n## Features\n\n- Swagger UI\n- Spring Security\n- Spring Session\n- RESTful API\n- User authentication + register\n- Page with some example\n\n\n## Sample Page\n\nA index page is included to help developers getting started.\nIt contains the link to the application's Swagger, the link to the default login form\nas well as another login form that uses the [login processing url](#login-processing-url)\n with a container for the server response of said example.\n\n![Sample page](/docs/img/sab-sample-page.png)\n\n\n## Endpoints\n\nOnly the necessary endpoints will be listed here. A full list of endpoints can be found using the Swagger UI.\n\n\n### Swagger UI\n\nThe Swagger UI is there to facilitate the development of your application, as it can allow you\nto easily view and interact with the backend's API.\n\nYou can view the swagger API by going at the following url: `/swagger-ui.html`\n\n\n### Login\n\nInitially, there is no user other than `root:root`, which is an admin.\n\nBy default, there's a login form at the following url: `/login`\n\n\n#### Login Processing URL\n\nAlternatively, you can use the **login processing url** to login from your frontend.\n\n| Key | Value | \n|:---:|:---:|\n| **Method** | POST |\n| **Path** | `/api/v1/login` |\n| **Parameters** | username, password |\n\nDue to the nature of authentication itself, you'll need to use `POST` in order to login using the **login processing url**.\n\n\n### Logout\n\n| Key | Value | \n|:---:|:---:|\n| **Method** | GET |\n| **Path** | `/logout` |\n| **Parameters** | - |\n\n\n### Creating an user\n\nBy default, the username must be at least 4 characters long and the password must be at least 8 characters long.\nThe only exception is the default `root:root` user, which **you should remove before publishing the project in production**.\n\n| Key | Value | \n|:---:|:---:|\n| **Method** | POST |\n| **Path** | `/api/v1/users` |\n| **Parameters** | username, password |\n\n\n### Getting the Authenticated User\n\n| Key | Value | \n|:---:|:---:|\n| **Method** | GET |\n| **Path** | `/api/v1/users/me` |\n| **Parameters** | - |\n\n\n## TODO\n\n- Authentication button on Swagger UI \n- More tests\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftwin%2Fspring-as-backend","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftwin%2Fspring-as-backend","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftwin%2Fspring-as-backend/lists"}