{"id":28208070,"url":"https://github.com/onewelcome/example-resource-gateway","last_synced_at":"2025-08-05T06:20:39.787Z","repository":{"id":42126889,"uuid":"59484792","full_name":"onewelcome/example-resource-gateway","owner":"onewelcome","description":null,"archived":false,"fork":false,"pushed_at":"2024-10-21T04:42:57.000Z","size":155,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":28,"default_branch":"master","last_synced_at":"2025-05-26T10:17:52.100Z","etag":null,"topics":["example"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":false,"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/onewelcome.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":"CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-05-23T13:23:37.000Z","updated_at":"2024-08-28T08:02:11.000Z","dependencies_parsed_at":"2024-08-28T08:56:50.717Z","dependency_job_id":null,"html_url":"https://github.com/onewelcome/example-resource-gateway","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/onewelcome/example-resource-gateway","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/onewelcome%2Fexample-resource-gateway","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/onewelcome%2Fexample-resource-gateway/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/onewelcome%2Fexample-resource-gateway/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/onewelcome%2Fexample-resource-gateway/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/onewelcome","download_url":"https://codeload.github.com/onewelcome/example-resource-gateway/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/onewelcome%2Fexample-resource-gateway/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259404100,"owners_count":22852118,"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":["example"],"created_at":"2025-05-17T14:11:38.346Z","updated_at":"2025-06-12T05:30:46.019Z","avatar_url":"https://github.com/onewelcome.png","language":"Java","readme":"# Example resource gateway\n\n[![CircleCI](https://circleci.com/gh/onewelcome/example-resource-gateway.svg?style=shield\u0026circle-token=6136616c3a42e02dbc404ba9fb568c493f0dc969)](https://circleci.com/gh/onewelcome/example-resource-gateway)\n\nThis example shows the basic functionality a resource gateway should support. The project is built based on Spring Boot.\n\nThe resource gateway supports bearer token usage via the authorization header according to [RFC6750](https://tools.ietf.org/html/rfc6750). This access token is\nvalidated via the Onegini Token Server. If the access token was proven to be valid, the actual resource is returned. In this example resource gateway\nthe [device api](https://docs.onegini.com/msp/stable/token-server/api-reference/end-user/device-v4.html) of the Onegini Token Server is exposed as resource. In\nthis example the Onegini Token Server acts both as an authorization server and as a resource server.\n\n```\n  +-------------+                           +------------------+                                          +-----------------+\n  | Onegini SDK | ---- (1) get devices ---\u003e | Resource Gateway |  ---- (2) validate access token    ---\u003e  |  Token Server   |\n  |             |                           |                  |                                          |                 |\n  |             | \u003c--- (6) user devices --- |                  |  \u003c---- (3) introspection response -----  |                 |\n  +-------------+                           +------------------+                                          +-----------------+\n                                               ^     |\n                                               |     |                                                    +-----------------+\n                                               |     +------------------- (4) get user device ---------\u003e  | Resource Server |\n                                               |                                                          | (Token Server)  |\n                                               +--------------------------- (5) user devices -----------  |                 |\n                                                                                                          +-----------------+\n```\n\n## Configuration\n\nRefer to the Spring\nBoot [Externalized Configuration](https://docs.spring.io/spring-boot/docs/current/reference/html/spring-boot-features.html#boot-features-external-config) for\nsetting the properties.\n\nThe following properties can be set for the Example Resource Gateway:\n\n| Property                                  | Default value | Example value               | Description\n|-------------------------------------------|---------------|-----------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\n| resource.gateway.tokenserver.baseUri      |               | http://localhost:7878/oauth | The base URI of the [Onegini Token Server](https://docs.onegini.com/msp/stable/token-server).\n| resource.gateway.tokenserver.clientId     |               |                             | The client id of the API client acting as resource gateway, see [Resource Gateway config](https://docs.onegini.com/msp/stable/token-server/topics/general-app-config/resource-gateway/resource-gateway.html).\n| resource.gateway.tokenserver.clientSecret |               |                             | The client secret of the API client acting as resource gateway.\n| device.api.serverRoot                     | The value of resource.gateway.tokenServer.baseUri | http://localhost:7878/oauth | The base uri of the resource server that returns a list of Devices. In this example, it is the base URI of the Onegini Token Server.\n| device.api.username                       |               |                             | The basic authentication username used to [access the End User api](https://docs.onegini.com/msp/stable/token-server/topics/technical-app-management/api-configuration/api-configuration.html) in the Onegini Token Server.\n| device.api.password                       |               |                             | The basic authentication password used to access the End User api in the Onegini Token Server.\n| spring.servlet.multipart.max-file-size    | 1MB           |                             | Sets the maximum file size per uploaded file.\n| spring.servlet.multipart.max-request-size | 10MB          |                             | Sets the maximum size of the HTTP request when uploading files.\n\n## Building the sourcecode\n\n`mvn clean install`\n\n## Run the application\n\nYou can either run the application via the Spring Boot Maven plugin or by using the jar file created while building the application.\n\n`mvn spring-boot:run`\n\nor\n\n`java -jar \u003clocation of the jar file\u003e`\n\n## Endpoints\n\nAll endpoints require a valid Bearer Access Token passed via the `Authorization` header.\n\nExample request:\n\n```http request\nGET /resources/devices HTTP/1.1\nAuthorization: Bearer 5F09FC2DD7DCDB72ABF1A6C026DF8FFB9D7D1F4AD069E34F0A6EC6206A593420\n```\n\n### List devices\n\nGET: `/resources/devices`\n\nRequires an Access token with scope `read`. Access tokens issued via\nthe [Implicit Authentication flow](https://docs.onegini.com/msp/stable/token-server/topics/mobile-apps/implicit-authentication/implicit-authentication.html) are\nrejected.\n\nReturns a list of devices for the user for which the Access Token was issued. Refer\nto [Device API v4](https://docs.onegini.com/msp/stable/token-server/api-reference/end-user/device-v4.html) for its response format.\n\n### Details of the application\n\nGET: `/resources/application-details`\n\nRequires an Access token with scope `application-details`. Access tokens issued via the Implicit Authentication flow are rejected.\n\nReturns an object with details of the (mobile) application for which the Access token was issued.\n\nExample response:\n\n```json\n{\n  \"application_identifier\": \"exampleApp\",\n  \"application_platform\": \"android\",\n  \"application_version\": \"1.0.0\"\n}\n```\n\n### Decorated user id\n\nGET: `/resources/user-id-decorated`\n\nRequires an Access token that was issued via the Implicit Authentication flow.\n\nReturns an object with a \"decorated\" user identifier.\n\nExample response:\n\n```json\n{\n  \"decorated_user_id\": \"✨ myDummyUserId ✨\"\n}\n```\n\n### File upload\n\nPOST: `/resources/file-upload`\n\nThis request accepts multipart/form-data with the following parameters:\n\n| Parameter name    | Type            | Required  | Remarks\n|-------------------|-----------------|-----------|---------------\n| name              | string          | no        |\n| email             | string          | no        |\n| attachments       | file (multiple) | no        | Multiple files can be sent as form-data with name \"attachments\"\n\nRequires an Access token with scope `write`. Access tokens issued via the Implicit Authentication flow are rejected.\n\nExample request:\n\n```http request\nPOST /resources/file-upload HTTP/1.1\nHost: resource.example.com\nAuthorization: Bearer 5F09FC2DD7DCDB72ABF1A6C026DF8FFB9D7D1F4AD069E34F0A6EC6206A593420\nContent-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW\n\n----WebKitFormBoundary7MA4YWxkTrZu0gW\nContent-Disposition: form-data; name=\"email\"\n\njane@example.com\n----WebKitFormBoundary7MA4YWxkTrZu0gW\nContent-Disposition: form-data; name=\"name\"\n\nJane Doe\n----WebKitFormBoundary7MA4YWxkTrZu0gW\nContent-Disposition: form-data; name=\"attachments\"; filename=\"background.jpg\"\nContent-Type: image/jpeg\n\n(data)\n----WebKitFormBoundary7MA4YWxkTrZu0gW\nContent-Disposition: form-data; name=\"attachments\"; filename=\"logo.svg\"\nContent-Type: image/svg+xml\n\n(data)\n----WebKitFormBoundary7MA4YWxkTrZu0gW\n```\n\nThis endpoint returns all parts in the response. The body is a Base64 encoded byte[] of the original file contents.\n\nExample response:\n\n```json\n{\n  \"name\": \"Jane Doe\",\n  \"email\": \"jane@example.com\",\n  \"attachments\": [\n    {\n      \"file_name\": \"background.jpg\",\n      \"file_size\": 34626,\n      \"content_type\": \"image/jpeg\",\n      \"body\": \"LzlqLzRBQVFTa1pKUmdBQkF…dk42UC9a\"\n    },\n    {\n      \"file_name\": \"logo.svg\",\n      \"file_size\": 1428,\n      \"content_type\": \"image/svg+xml\",\n      \"body\": \"UEhOMlp5QjRiV3h1Y3o…1jKw==\"\n    }\n  ]\n}\n```\n\n## Releasing\n\n- Update the [CHANGELOG.md](CHANGELOG.md). Make sure that the version you are releasing is mentioned\n- Create a tag either from the GitHub UI or through git. Make sure that the name of the tag only contains the version number that you want to release,\n  e.g. `2.0.0`.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fonewelcome%2Fexample-resource-gateway","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fonewelcome%2Fexample-resource-gateway","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fonewelcome%2Fexample-resource-gateway/lists"}