{"id":45589396,"url":"https://github.com/abarhub/spring-boot-oauth-client","last_synced_at":"2026-02-23T12:01:30.729Z","repository":{"id":42537449,"uuid":"325954866","full_name":"abarhub/spring-boot-oauth-client","owner":"abarhub","description":null,"archived":false,"fork":false,"pushed_at":"2023-01-06T21:46:27.000Z","size":2606,"stargazers_count":1,"open_issues_count":16,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2023-03-25T15:30:54.328Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"HTML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/abarhub.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-01-01T10:05:00.000Z","updated_at":"2023-03-04T18:16:43.000Z","dependencies_parsed_at":"2023-02-06T09:32:08.260Z","dependency_job_id":null,"html_url":"https://github.com/abarhub/spring-boot-oauth-client","commit_stats":null,"previous_names":[],"tags_count":null,"template":null,"template_full_name":null,"purl":"pkg:github/abarhub/spring-boot-oauth-client","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abarhub%2Fspring-boot-oauth-client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abarhub%2Fspring-boot-oauth-client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abarhub%2Fspring-boot-oauth-client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abarhub%2Fspring-boot-oauth-client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/abarhub","download_url":"https://codeload.github.com/abarhub/spring-boot-oauth-client/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abarhub%2Fspring-boot-oauth-client/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29742149,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-23T07:44:07.782Z","status":"ssl_error","status_checked_at":"2026-02-23T07:44:07.432Z","response_time":90,"last_error":"SSL_read: 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":[],"created_at":"2026-02-23T12:01:28.766Z","updated_at":"2026-02-23T12:01:30.713Z","avatar_url":"https://github.com/abarhub.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"# spring-boot-oauth-client\n\nImplémentation d'OpenId Connect avec KeyCloak\n\nC'est avec KeyCloak 11.0.3.\n\nPour Spring, il faut ajouter la dependance :\n```xml\n\u003cdependency\u003e\n    \u003cgroupId\u003eorg.springframework.boot\u003c/groupId\u003e\n    \u003cartifactId\u003espring-boot-starter-oauth2-resource-server\u003c/artifactId\u003e\n\u003c/dependency\u003e\n```\nIl faut aussi ajouter en configuration :\n\n```yml\nspring:\n    security:\n        oauth2:\n            resourceserver:\n                jwt:\n                    issuer-uri: http://localhost:8180/auth/realms/test1\n                    jwk-set-uri: http://localhost:8180/auth/realms/test1/protocol/openid-connect/certs\n```\n\nPour Angular, il faut utiliser la librairie angular-oauth2-oidc.\nSites :\nhttps://manfredsteyer.github.io/angular-oauth2-oidc/docs/\nhttps://github.com/manfredsteyer/angular-oauth2-oidc\nhttps://www.npmjs.com/package/angular-oauth2-oidc\n\nL'authentifiation avec Angular doit être fait avec code flow + PKCE, et pas avec implicit flow, qui est moins sécurisé.\n\nPour l'authentification, :\n1) Angular redirige vers KeyCloak,\n2) KeyCloak fait l'authentification et redirige vers le navigateur\n3) le navigateur enregistre le token et l'utilise pour appeler le endpoind spring\n4) Spring vérifie le token et récupère de keycloak les informations de l'utilisateur et crée la session\n5) le endpoint fait son traitement\n\nLe vériviation du token dans Spring n'est fait qu'une seule fois, elle n'est plus faite apres.\nDans Angular, il faut lui dire de faire le rafrechissement régulièrement.\nhttps://manfredsteyer.github.io/angular-oauth2-oidc/docs/additional-documentation/refreshing-a-token.html\n\nDans KeyCloak, il faut définir le temps maximum de rafrechissement du token\n\nSi Spring a besoin d'accéder a des info de KeyCloak, il ne doit pas utiliser le token venant d'Angular,\nmais faire la propre connection avec login/mot de passe.\n\n\n\n\nAides :\n\nhttps://www.baeldung.com/spring-webclient-oauth2\nhttps://www.appsdeveloperblog.com/keycloak-rest-api-create-a-new-user/\nhttp://localhost:8180/auth/\nhttp://localhost:4200/\nhttps://stackoverflow.com/questions/56743109/keycloak-create-admin-user-in-a-realm\nhttps://gist.github.com/luciddreamz/83a888eedd9274b4045a3ab8af064faa\nhttps://www.baeldung.com/postman-keycloak-endpoints\nhttps://www.keycloak.org/docs-api/5.0/rest-api/index.html#_roles_resource\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fabarhub%2Fspring-boot-oauth-client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fabarhub%2Fspring-boot-oauth-client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fabarhub%2Fspring-boot-oauth-client/lists"}