{"id":19714035,"url":"https://github.com/grails/grails-spring-security-rest-java-client","last_synced_at":"2025-04-29T18:31:43.141Z","repository":{"id":136944910,"uuid":"79108219","full_name":"grails/grails-spring-security-rest-java-client","owner":"grails","description":null,"archived":true,"fork":false,"pushed_at":"2017-01-20T09:10:54.000Z","size":62,"stargazers_count":2,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-20T15:22:12.517Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","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/grails.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-01-16T10:35:46.000Z","updated_at":"2024-12-05T02:38:34.000Z","dependencies_parsed_at":null,"dependency_job_id":"0df65641-ac61-4b0e-98fe-a461e2dbebf6","html_url":"https://github.com/grails/grails-spring-security-rest-java-client","commit_stats":{"total_commits":6,"total_committers":1,"mean_commits":6.0,"dds":0.0,"last_synced_commit":"523ff7123b133d23b5ae4d07c84d23ac7334f20f"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grails%2Fgrails-spring-security-rest-java-client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grails%2Fgrails-spring-security-rest-java-client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grails%2Fgrails-spring-security-rest-java-client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grails%2Fgrails-spring-security-rest-java-client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/grails","download_url":"https://codeload.github.com/grails/grails-spring-security-rest-java-client/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251481224,"owners_count":21596160,"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":[],"created_at":"2024-11-11T22:28:35.627Z","updated_at":"2025-04-29T18:31:43.103Z","avatar_url":"https://github.com/grails.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Java Client - Spring Security Rest for Grails\n \nJava library to interact with [Spring Security Rest for Grails](http://alvarosanchez.github.io/grails-spring-security-rest/latest/docs/) plugin.\n\nIt uses the [JSON Web Token (JWT)](http://alvarosanchez.github.io/grails-spring-security-rest/latest/docs/#_json_web_token) capabilities offered by plugin. \n\n## Installation\n\n```grovoy\nrepositories {\n    jcenter()\n}\n\ndependencies {\n    compile 'org.grails:java-client-grails-spring-security-rest:0.3'\n}\n```\n\n## Login\n\n[Authentication Request](http://alvarosanchez.github.io/grails-spring-security-rest/latest/docs/#_authentication_endpoint):\n\n```java\nString serverUrl = \"http://localhost:8080\";\nString username = \"sherlock\";\nString password = \"elementary\";\ndef authenticationRequest = new AuthenticationRequest.Builder()\n                .serverUrl(serverUrl)\n                .username(username)\n                .password(password)\n                .build();\nJwtResponse rsp = client.authenticate(authenticationRequest);\n```\n\n### Correct Credentials\n\nIf authentication is successful a _JwtResponseOK_ object is returned. This object\ncontains a Jwt property. \n\n```java\npublic interface Jwt {\n    String getUsername();\n\n    List\u003cString\u003e getRoles();\n\n    String getTokenType();\n\n    String getAccessToken();\n\n    int getExpiresIn();\n\n    String getRefreshToken();\n}\n```\n\n### Incorrect Credentials\n\nIf the credentials are incorrect a _JwtResponseUnauthorized_ object is returned.\n\n## Token Refresh\n\nTo refresh the credentials issue this request: \n\n```java\nString refreshToken = \"eyJhbGciOiJIUzI1NiJ9.eyJwcmluY2lwYWwiOiJINHNJQUFBQUFBQUFBSlZTUFVcL2NRQlI4dmh5Q0NJbVBTSW1VQXBwQUZcL21rcEx3cWgwZ2taSEVJY3cxSW9EMzdZUmJXdTJaM0RYY051aW9wS0loSWtCRDhCZjVKMHVRSFJLR2dwYWJOVzhQaGd3YXhsZjEyUEROdnhoZlhNR1EwZkV3MDQ4TDRtY2dUTG4yVGFTNFRnMUd1dWUzNnVVRWRveTBRWHdwZ2l5WndlN3dLZUFGVWVHemhWYkROOWxoTk1KblVtdTF0akd5OW8rR0Qwc2tkNDZabUtlNHJ2ZVBmYzBkSzR3T0JrdG83cThEd0treXlLRks1dEl0S3puY3lyakZlaFlseUZxaG94NDFlUjNTRDBuSW16Q0IwR0NWckM0d0RHR1c1M1ZLa3l0RllHTDgxbTFzdWFpSGFlZ0FqR1RPRzNEM2FKTFRPdXJ0M05pVnRzQXNIVU8xa0hoM0tidFpCZmNmanp5a2hhR3V1cEpscHlWVEZmSk03Y2VMdlRSM1wvT1RydnRTb0FsTW43cDc4cDUyOGIwUHUxZmpOZEJPMUZGdDRNV0M5aDlVNUdiaVpMNWhXTlR2bnY2ZEtQayt0dmF5OUkyU0UrUDcrUG1VOTN5WFhuVkpveHphd2E2SWhvOTZ2dW1jZ2JUNVAzVytqNklVOHpnZlJIU1l2eHZVUkpUT3RXdFJMOXZDMjhYRzRHOHh1TlpoaTZ0eEd6aFZwUVwvYVE3VnF6dCt2SURSVzBkWG4zXC9mZlR1SDNFc3dOQWVFemxTNmhNbGFERlAyNmlcL1hweE1qZjY4UEN4MjZQXC9QXC93R3dmS0JsRXdNQUFBPT0iLCJzdWIiOiJzaGVybG9jayIsInJvbGVzIjpbIlJPTEVfQk9TUyJdLCJpYXQiOjE0ODQ1NjA1MTB9.PB3epeHlU_dC22-X5hkidR5IF19WTcpRilKkgUjgqGM\";\ndef refreshRequest = new RefreshRequest.Builder()\n                .serverUrl(serverUrl)\n                .refreshToken()\n                .build();\ndef rsp = client.refreshToken(refreshRequest);\n((JwtResponseOK) rsp).getJwt().getAccessToken();\n```\n\n## Dependencies\n\nThe library uses internally [OkHttp](http://square.github.io/okhttp/) and [Gson](https://github.com/google/gson)\n\n## Author\n\nSergio del Amo - delamos@ociweb.com\n \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgrails%2Fgrails-spring-security-rest-java-client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgrails%2Fgrails-spring-security-rest-java-client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgrails%2Fgrails-spring-security-rest-java-client/lists"}