https://github.com/onewelcome/onegini-msp-example-security-proxy-request-mapper
https://github.com/onewelcome/onegini-msp-example-security-proxy-request-mapper
example
Last synced: 4 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/onewelcome/onegini-msp-example-security-proxy-request-mapper
- Owner: onewelcome
- License: apache-2.0
- Created: 2016-09-28T12:41:31.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2023-09-06T08:51:27.000Z (over 2 years ago)
- Last Synced: 2025-06-12T05:39:21.902Z (8 months ago)
- Topics: example
- Language: Java
- Homepage:
- Size: 108 KB
- Stars: 0
- Watchers: 29
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
- Codeowners: CODEOWNERS
Awesome Lists containing this project
README
# Example Request Mapper
[](https://circleci.com/gh/onewelcome/example-security-proxy-request-mapper/tree/master)
Request mapper is an extension to the Onegini Security Proxy, which allows to give instructions on how to modify request before it gets to a resource server.
For more information please see [Security Proxy Request Mapper Documentation](https://docs.onegini.com/msp/latest/security-proxy/topics/embedded-resource-gateway-functionality/implement-request-mapper.html)
## Frameworks
In the Example Request Mapper project the following main frameworks are used:
- Undertow (the reason for using it over Spring MVC is because of its lightweight and better performance)
- Spring Boot
## Configuration
| Property | Default value | Description |
|-------------------------------|---------------|-----------------------------------------------------------|
| basic.authentication.username | username | The basic authentication username used to access the api. |
| basic.authentication.password | password | The basic authentication password used to access the api. |
| onegini.undertow.port | 5540 | The port on which Request Mapper will be exposed. |
| onegini.undertow.host | 0.0.0.0 | The host where Request Mapper will be exposed. | |
## Build the sourcecode
`mvn clean install`
## Build the application with docker
` mvn pl.project13.maven:git-commit-id-plugin:revision jib:build -Pjib`
## Run the application
You can either run the application via the Spring Boot Maven plugin or by using the jar file created while building the application.
`mvn spring-boot:run`
or
`java -jar `
or (via Docker)
`docker run example-security-proxy-resource-gateway:latest -P5540:5540`
## Example request
```http
POST /map-request HTTP/1.1
Host: localhost:5540
Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=
Content-Type: application/json
{
"request_uri": "/some-resource-gateway-request-uri",
"token_validation_result": {
"scope": "exampleScope",
"sub": "exampleUserId",
"amr": [
"DEFAULT"
]
...
},
"headers": {
"header_1":"value_1",
"header_2":"value_2",
"authorization": "Bearer 060E7B02C875D5D74318FE0BBDA22BEFBA882B9B90F918BE77F9FCFF1A0E24B0"
}
}
```
## Example response
```http
HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
{
"request_uri": "/some-resource-gateway-request-uri/exampleUserId",
"headers": {
"header_1": "value_1",
"header_2": "value_2",
"authorized_scopes": "exampleScope"
}
}
```
## Release
To create a release:
1. Go to [Create release](https://github.com/onewelcome/onegini-msp-example-security-proxy-request-mapper/releases/new) page
2. Create git tag with version name
3. Generate release notes with `Auto-generate release notes`
4. Verify if release notes are correct
5. If it is valid then press `Publish release`