{"id":14956677,"url":"https://github.com/transempiric/webfluxtemplate","last_synced_at":"2025-10-24T10:30:51.744Z","repository":{"id":44814645,"uuid":"118954072","full_name":"TransEmpiric/webFluxTemplate","owner":"TransEmpiric","description":"Spring Webflux template application with working Spring Security, Web-sockets, Rest, Web MVC, and Authentication with JWT.","archived":false,"fork":false,"pushed_at":"2018-05-14T21:47:47.000Z","size":262,"stargazers_count":125,"open_issues_count":2,"forks_count":39,"subscribers_count":17,"default_branch":"master","last_synced_at":"2025-01-29T09:44:54.177Z","etag":null,"topics":["gradle","java8","json-web-token","jwt-authentication","jwt-bearer-tokens","microservices-architecture","mongodb","mongodb-database","netty-websocket","reactive","restcontroller","restful-api","sping-reactive","spring","spring-boot","spring-security","web-sockets","webflux","websocket","websockets"],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/TransEmpiric.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-01-25T18:52:34.000Z","updated_at":"2024-11-28T15:40:05.000Z","dependencies_parsed_at":"2022-07-13T11:00:34.824Z","dependency_job_id":null,"html_url":"https://github.com/TransEmpiric/webFluxTemplate","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TransEmpiric%2FwebFluxTemplate","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TransEmpiric%2FwebFluxTemplate/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TransEmpiric%2FwebFluxTemplate/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TransEmpiric%2FwebFluxTemplate/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TransEmpiric","download_url":"https://codeload.github.com/TransEmpiric/webFluxTemplate/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":237950791,"owners_count":19392666,"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":["gradle","java8","json-web-token","jwt-authentication","jwt-bearer-tokens","microservices-architecture","mongodb","mongodb-database","netty-websocket","reactive","restcontroller","restful-api","sping-reactive","spring","spring-boot","spring-security","web-sockets","webflux","websocket","websockets"],"created_at":"2024-09-24T13:13:20.239Z","updated_at":"2025-10-24T10:30:51.183Z","avatar_url":"https://github.com/TransEmpiric.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Spring 5 Webflux Template\n\nThis code can be used to build the next generation of applications using micro-services, reactive programing, webs-sockets, rest, mongoDB, JWT (JSON Web Tokens) and Netty.\n\n## What is this again?\n\nThis is a complete template example for Spring 5 Webflux.\nThe application shows how to use Spring 5 Webflux with Spring Security, web-sockets, @RestContorler, @Controller, Reactive MongoDB, and JWT.\n\nSpring 5 is still new.  There are very few examples of how to use Spring Security with the Webflux stack.\nReactive Oauth2 support is not ready yet.  This application roles it's own Oauth2 like api with JWT tokens.\nThis app has integrated web-sockets and rest services into the Reactive Spring Security implementation.\n\n#### MongoDB\nMongoDB is used for this example, so you'll need this up and running on your local machine, if you are on OSX, you can easily install\nMongoDB using Homebrew.\nThe MongoDB config is defined in application.yml.\n\n## Running locally\n```\n\tgit clone https://github.com/TransEmpiric/webFluxTemplate.git\n\tcd webFluxTemplate\n\t./gradlew bootRun\n```\n\nIf everything goes well you can go to the Secure Web-socket Example page [http://localhost:8443/test/ws](http://localhost:8443/test/ws)\n\n#### Get a JWT for authentication\nEndpoint:\u003cbr/\u003e\nhttp://localhost:8443/auth/token\n\nMethod:\u003cbr/\u003e\nPOST:\u003cbr/\u003e\n\nRequest headers:\n```\ncontent-type: application/json\n```\nBody:\n```\n{\"username\" : \"jdev\", \"password\":\"jdev\"}\n```\nResponse:\n```\n{\n\"token\": \"eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJqZGV2IiwiYXVkIjoidW5rbm93biIsImV4cCI6MjEyMTcwNzgyMiwiaWF0IjoxNTE2OTA3ODIyfQ.TVwbWsz-BDfMQmgUDnB_GloXklEdS_ABMiF9iGzHrBNA1f4yOQb3day7vcFLNxcLefkQjZDlVlpU91AtkzQqLg\",\n\"username\": \"jdev\"\n}\n```\n\n#### Use JWT on a secure rest endpoint\nEndpoint:\u003cbr/\u003e\nhttp://localhost:8443/api/rest/user/list:\u003cbr/\u003e\n\nMethod:\u003cbr/\u003e\nGET:\u003cbr/\u003e\n\nRequest headers:\n```\nContent-Type: application/json\nAuthorization: Bearer eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJqZGV2IiwiYXVkIjoidW5rbm93biIsImV4cCI6MjEyMTcwNzgyMiwiaWF0IjoxNTE2OTA3ODIyfQ.TVwbWsz-BDfMQmgUDnB_GloXklEdS_ABMiF9iGzHrBNA1f4yOQb3day7vcFLNxcLefkQjZDlVlpU91AtkzQqLg\n```\nResponse:\n```\n[\n   {\n      \"id\":\"5a6a2ef094bf49a0b8319a30\",\n      \"username\":\"jdev\",\n      \"firstname\":\"Joe\",\n      \"lastname\":\"Developer\",\n      \"email\":\"dev@transempiric.com\",\n      \"roles\":[\n         \"ROLE_ADMIN\"\n      ],\n      \"enabled\":true,\n      \"lastPasswordResetDate\":1516908272107,\n      \"accountNonExpired\":true,\n      \"accountNonLocked\":true,\n      \"credentialsNonExpired\":true,\n      \"authorities\":[\n         {\n            \"authority\":\"ROLE_ADMIN\"\n         }\n      ]\n   }\n]\n```\n\n#### Use JWT on a secure web-socket endpoint\nGo to [http://localhost:8443/test/ws](http://localhost:8443/test/ws) in a browser.\nJWT is hard coded in the JS within templates/websocket.ftl\nYou need to replace with a new token if the hard coded token has expired\n```\n    \u003cscript type=\"application/javascript\"\u003e\n        // Use wss:// for HTTPS\n        var socket = new WebSocket(\"ws://\" + location.host + \"/api/ws/echotest?token=eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJqZGV2IiwiYXVkIjoidW5rbm93biIsImV4cCI6MjEyMTYwODkyMywiaWF0IjoxNTE2ODA4OTIzfQ.QdSkOuGb8tp1QKjRKzUPlUqobNzF0PuDNk4Y7qAXqrVdbVaKiNJPalxUYapDoeQxE_Dz9WqhdrpdLpGQnlgkkw\");\n\n        addEvent(\"keypress\", document.getElementById('input'), function(event) {\n            socket.send(event.key);\n        });\n        var output = document.getElementById(\"output\");\n        socket.onmessage = function(e) {\n            output.innerHTML = output.innerHTML + e.data;\n        }\n    \u003c/script\u003e\n```\n\n#### Properties\n```\nProperties are in application.yml\nYou can set to HTTPS (test cert works) if you want, but make sure to update the call to web-socket endpoints with \"wss://\"\n```\n#### WILLDO\n```\nVerify password at auth end point with CustomPasswordEncoder\nMake a UI for example token retrieval and a UI to use it\nFinish Refresh Token code\nAdd React and/or Angular Front-end example to repo\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftransempiric%2Fwebfluxtemplate","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftransempiric%2Fwebfluxtemplate","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftransempiric%2Fwebfluxtemplate/lists"}