forked from bxservice/idempiere-rest
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Amazon Cognito SSO support to iDempiere bxservice#252
- Loading branch information
Showing
8 changed files
with
812 additions
and
116 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
...i/OSGI-INF/com.trekglobal.idempiere.rest.api.oidc.amazoncognito.AmazonCognitoProvider.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" immediate="true" name="com.trekglobal.idempiere.rest.api.oidc.amazoncognito.AmazonCognitoProvider"> | ||
<property name="name" value="Amazon Cognito"/> | ||
<service> | ||
<provide interface="com.trekglobal.idempiere.rest.api.oidc.IOIDCProvider"/> | ||
</service> | ||
<implementation class="com.trekglobal.idempiere.rest.api.oidc.amazoncognito.AmazonCognitoProvider"/> | ||
</scr:component> |
218 changes: 218 additions & 0 deletions
218
...global.idempiere.rest.api/amazon-cognito/amazon-cognito-oidc-test.postman_collection.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,218 @@ | ||
{ | ||
"info": { | ||
"_postman_id": "9671d7a1-8fa9-4731-80ef-57d144c5afcd", | ||
"name": "amazon-cognito-oidc-test", | ||
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", | ||
"_exporter_id": "27359776", | ||
"_collection_link": "https://lunar-astronaut-434175.postman.co/workspace/GraphQL-Wrapper-for-iDempiere-R~c90f44fb-2bfc-4c52-8da6-093a705eddf2/collection/27359776-9671d7a1-8fa9-4731-80ef-57d144c5afcd?action=share&source=collection_link&creator=27359776" | ||
}, | ||
"item": [ | ||
{ | ||
"name": "Get Token", | ||
"event": [ | ||
{ | ||
"listen": "test", | ||
"script": { | ||
"exec": [ | ||
"var jsonData = pm.response.json();", | ||
"pm.environment.set(\"AccessToken\", jsonData.AuthenticationResult.AccessToken);", | ||
"pm.environment.set(\"IdToken\", jsonData.AuthenticationResult.IdToken);", | ||
"pm.environment.set(\"RefreshToken\", jsonData.AuthenticationResult.RefreshToken);", | ||
"pm.environment.set(\"TokenType\", jsonData.AuthenticationResult.TokenType);" | ||
], | ||
"type": "text/javascript", | ||
"packages": {} | ||
} | ||
} | ||
], | ||
"request": { | ||
"method": "POST", | ||
"header": [ | ||
{ | ||
"key": "Content-Type", | ||
"value": "application/x-amz-json-1.1", | ||
"type": "text" | ||
}, | ||
{ | ||
"key": "X-Amz-Target", | ||
"value": "AWSCognitoIdentityProviderService.InitiateAuth", | ||
"type": "text" | ||
} | ||
], | ||
"body": { | ||
"mode": "raw", | ||
"raw": "{\r\n \"AuthFlow\": \"USER_PASSWORD_AUTH\",\r\n \"AuthParameters\": {\r\n \"USERNAME\": \"{{cognitoUsername}}\",\r\n \"PASSWORD\": \"{{cognitoPassword}}\",\r\n \"SECRET_HASH\": \"{{cognitoSecretHash}}\"\r\n },\r\n \"ClientId\": \"{{cognitoClientId}}\"\r\n}", | ||
"options": { | ||
"raw": { | ||
"language": "json" | ||
} | ||
} | ||
}, | ||
"url": { | ||
"raw": "https://cognito-idp.{{cognitoRegion}}.amazonaws.com", | ||
"protocol": "https", | ||
"host": [ | ||
"cognito-idp", | ||
"{{cognitoRegion}}", | ||
"amazonaws", | ||
"com" | ||
] | ||
} | ||
}, | ||
"response": [] | ||
}, | ||
{ | ||
"name": "Refresh Token", | ||
"event": [ | ||
{ | ||
"listen": "test", | ||
"script": { | ||
"exec": [ | ||
"var jsonData = pm.response.json();", | ||
"pm.environment.set(\"AccessToken\", jsonData.AuthenticationResult.AccessToken);", | ||
"pm.environment.set(\"IdToken\", jsonData.AuthenticationResult.IdToken);", | ||
"pm.environment.set(\"TokenType\", jsonData.AuthenticationResult.TokenType);", | ||
"if (jsonData.AuthenticationResult.RefreshToken != null)", | ||
" pm.environment.set(\"RefreshToken\", jsonData.AuthenticationResult.RefreshToken);" | ||
], | ||
"type": "text/javascript", | ||
"packages": {} | ||
} | ||
} | ||
], | ||
"request": { | ||
"method": "POST", | ||
"header": [ | ||
{ | ||
"key": "Content-Type", | ||
"value": "application/x-amz-json-1.1", | ||
"type": "text" | ||
}, | ||
{ | ||
"key": "X-Amz-Target", | ||
"value": "AWSCognitoIdentityProviderService.InitiateAuth", | ||
"type": "text" | ||
} | ||
], | ||
"body": { | ||
"mode": "raw", | ||
"raw": "{\r\n \"AuthFlow\": \"REFRESH_TOKEN_AUTH\",\r\n \"AuthParameters\": {\r\n \"REFRESH_TOKEN\": \"{{RefreshToken}}\",\r\n \"SECRET_HASH\": \"{{cognitoSecretHash}}\"\r\n },\r\n \"ClientId\": \"{{cognitoClientId}}\"\r\n}", | ||
"options": { | ||
"raw": { | ||
"language": "json" | ||
} | ||
} | ||
}, | ||
"url": { | ||
"raw": "https://cognito-idp.{{cognitoRegion}}.amazonaws.com", | ||
"protocol": "https", | ||
"host": [ | ||
"cognito-idp", | ||
"{{cognitoRegion}}", | ||
"amazonaws", | ||
"com" | ||
] | ||
} | ||
}, | ||
"response": [] | ||
}, | ||
{ | ||
"name": "api/v1/models/{table name}?filter={where clause}", | ||
"request": { | ||
"method": "GET", | ||
"header": [ | ||
{ | ||
"key": "Content-Type", | ||
"value": "application/json", | ||
"type": "text" | ||
}, | ||
{ | ||
"key": "Accept", | ||
"value": "application/json", | ||
"type": "text" | ||
}, | ||
{ | ||
"key": "Authorization", | ||
"value": "Bearer {{AccessToken}}", | ||
"type": "text" | ||
}, | ||
{ | ||
"key": "IdToken", | ||
"value": "{{IdToken}}", | ||
"type": "text" | ||
} | ||
], | ||
"url": { | ||
"raw": "{{protocol}}://{{host}}:{{port}}/api/v1/models/C_Tax?filter=C_TaxCategory_ID=107", | ||
"protocol": "{{protocol}}", | ||
"host": [ | ||
"{{host}}" | ||
], | ||
"port": "{{port}}", | ||
"path": [ | ||
"api", | ||
"v1", | ||
"models", | ||
"C_Tax" | ||
], | ||
"query": [ | ||
{ | ||
"key": "filter", | ||
"value": "C_TaxCategory_ID=107" | ||
} | ||
] | ||
} | ||
}, | ||
"response": [] | ||
}, | ||
{ | ||
"name": "api/v1/models/{table name}?select={columnname list}", | ||
"request": { | ||
"method": "GET", | ||
"header": [ | ||
{ | ||
"key": "Content-Type", | ||
"value": "application/json", | ||
"type": "text" | ||
}, | ||
{ | ||
"key": "Accept", | ||
"value": "application/json", | ||
"type": "text" | ||
}, | ||
{ | ||
"key": "Authorization", | ||
"value": "Bearer {{AccessToken}}", | ||
"type": "text" | ||
}, | ||
{ | ||
"key": "IdToken", | ||
"value": "{{IdToken}}", | ||
"type": "text" | ||
} | ||
], | ||
"url": { | ||
"raw": "{{protocol}}://{{host}}:{{port}}/api/v1/models/C_Order?select=DocumentNo,Description", | ||
"protocol": "{{protocol}}", | ||
"host": [ | ||
"{{host}}" | ||
], | ||
"port": "{{port}}", | ||
"path": [ | ||
"api", | ||
"v1", | ||
"models", | ||
"C_Order" | ||
], | ||
"query": [ | ||
{ | ||
"key": "select", | ||
"value": "DocumentNo,Description" | ||
} | ||
] | ||
} | ||
}, | ||
"response": [] | ||
} | ||
] | ||
} |
124 changes: 124 additions & 0 deletions
124
...mpiere.rest.api/amazon-cognito/environment-http---localhost-8080.postman_environment.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,124 @@ | ||
{ | ||
"id": "0d637021-95f8-45c9-8fc1-91e3982106ca", | ||
"name": "environment-http://localhost:8080", | ||
"values": [ | ||
{ | ||
"key": "protocol", | ||
"value": "http", | ||
"enabled": true | ||
}, | ||
{ | ||
"key": "host", | ||
"value": "localhost", | ||
"enabled": true | ||
}, | ||
{ | ||
"key": "port", | ||
"value": "8080", | ||
"enabled": true | ||
}, | ||
{ | ||
"key": "userName", | ||
"value": "GardenAdmin", | ||
"enabled": true | ||
}, | ||
{ | ||
"key": "password", | ||
"value": "GardenAdmin", | ||
"type": "secret", | ||
"enabled": true | ||
}, | ||
{ | ||
"key": "clientId", | ||
"value": "11", | ||
"enabled": true | ||
}, | ||
{ | ||
"key": "roleId", | ||
"value": "102", | ||
"enabled": true | ||
}, | ||
{ | ||
"key": "organizationId", | ||
"value": "11", | ||
"enabled": true | ||
}, | ||
{ | ||
"key": "warehouseId", | ||
"value": "103", | ||
"enabled": true | ||
}, | ||
{ | ||
"key": "language", | ||
"value": "en_US", | ||
"enabled": true | ||
}, | ||
{ | ||
"key": "sysuserName", | ||
"value": "SuperUser", | ||
"enabled": true | ||
}, | ||
{ | ||
"key": "syspassword", | ||
"value": "System", | ||
"enabled": true | ||
}, | ||
{ | ||
"key": "AccessToken", | ||
"value": "", | ||
"type": "any", | ||
"enabled": true | ||
}, | ||
{ | ||
"key": "RefreshToken", | ||
"value": "", | ||
"type": "any", | ||
"enabled": true | ||
}, | ||
{ | ||
"key": "cognitoRegion", | ||
"value": "ap-southeast-2", | ||
"type": "default", | ||
"enabled": true | ||
}, | ||
{ | ||
"key": "cognitoUsername", | ||
"value": "GardenAdmin", | ||
"type": "default", | ||
"enabled": true | ||
}, | ||
{ | ||
"key": "cognitoPassword", | ||
"value": "", | ||
"type": "secret", | ||
"enabled": true | ||
}, | ||
{ | ||
"key": "cognitoSecretHash", | ||
"value": "", | ||
"type": "secret", | ||
"enabled": true | ||
}, | ||
{ | ||
"key": "cognitoClientId", | ||
"value": "", | ||
"type": "default", | ||
"enabled": true | ||
}, | ||
{ | ||
"key": "IdToken", | ||
"value": "", | ||
"type": "any", | ||
"enabled": true | ||
}, | ||
{ | ||
"key": "TokenType", | ||
"value": "", | ||
"type": "any", | ||
"enabled": true | ||
} | ||
], | ||
"_postman_variable_scope": "environment", | ||
"_postman_exported_at": "2024-10-10T03:56:28.649Z", | ||
"_postman_exported_using": "Postman/11.16.0" | ||
} |
Oops, something went wrong.