@boxyhq/saml-jackson 0.1.5-beta.135 → 0.1.5-beta.139

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -130,7 +130,7 @@ Please follow the instructions [here](https://docs.google.com/document/d/1fk---Z
130
130
 
131
131
  ### 1.1 SAML profile/claims/attributes mapping
132
132
 
133
- As outlined in the guide above we try and support 4 attributes in the SAML claims - `id`, `email`, `firstName`, `lastName`. This is how the common SAML aattributes map over for most providers, but some providers have custom mappings. Please refer to the documentation on Identity Provider to understand the exact mapping.
133
+ As outlined in the guide above we try and support 4 attributes in the SAML claims - `id`, `email`, `firstName`, `lastName`. This is how the common SAML attributes map over for most providers, but some providers have custom mappings. Please refer to the documentation on Identity Provider to understand the exact mapping.
134
134
 
135
135
  | SAML Attribute | Jackson mapping |
136
136
  | -------------------------------------------------------------------- | --------------- |
@@ -164,7 +164,28 @@ curl --location --request POST 'http://localhost:6000/api/v1/saml/config' \
164
164
  - tenant: Jackson supports a multi-tenant architecture, this is a unique identifier you set from your side that relates back to your customer's tenant. This is normally an email, domain, an account id, or user-id
165
165
  - product: Jackson support multiple products, this is a unique identifier you set from your side that relates back to the product your customer is using
166
166
 
167
- The response returns a JSON with `client_id` and `client_secret` that can be stored against your tenant and product for a more secure OAuth 2.0 flow. If you do not want to store the `client_id` and `client_secret` you can alternatively use `client_id=tenant=<tenantID>&product=<productID>` and any arbitrary value for `client_secret` when setting up the OAuth 2.0 flow.
167
+ The response returns a JSON with `client_id` and `client_secret` that can be stored against your tenant and product for a more secure OAuth 2.0 flow. If you do not want to store the `client_id` and `client_secret` you can alternatively use `client_id=tenant=<tenantID>&product=<productID>` and any arbitrary value for `client_secret` when setting up the OAuth 2.0 flow. Additionally a `provider` attribute is also returned which indicates the domain of your Identity Provider.
168
+
169
+ #### 2.1 SAML get config API
170
+
171
+ This endpoint can be used to return metadata about an existing SAML config. This can be used to check and display the details to your customers. You can use either `clientID` or `tenant` and `product` combination.
172
+
173
+ ```
174
+ curl --location --request POST 'http://localhost:6000/api/v1/saml/config/get' \
175
+ --header 'Authorization: Api-Key <Jackson API Key>' \
176
+ --header 'Content-Type: application/x-www-form-urlencoded' \
177
+ --data-urlencode 'tenant=boxyhq.com' \
178
+ --data-urlencode 'product=demo'
179
+ ```
180
+
181
+ ```
182
+ curl --location --request POST 'http://localhost:6000/api/v1/saml/config/get' \
183
+ --header 'Authorization: Api-Key <Jackson API Key>' \
184
+ --header 'Content-Type: application/x-www-form-urlencoded' \
185
+ --data-urlencode 'clientID=<Client ID>'
186
+ ```
187
+
188
+ The response returns a JSON with `provider` indicating the domain of your Identity Provider. If an empty JSON payload is returned then we do not have any configuration stored for the attributes you requested.
168
189
 
169
190
  ### 3. OAuth 2.0 Flow
170
191
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@boxyhq/saml-jackson",
3
- "version": "0.1.5-beta.135",
3
+ "version": "0.1.5-beta.139",
4
4
  "license": "Apache 2.0",
5
5
  "description": "SAML 2.0 service",
6
6
  "main": "src/index.js",
@@ -78,13 +78,14 @@ const config = async (body) => {
78
78
  return {
79
79
  client_id: clientID,
80
80
  client_secret: clientSecret,
81
+ provider: idpMetadata.provider,
81
82
  };
82
83
  };
83
84
 
84
85
  const getConfig = async (body) => {
85
- const { clientID, clientSecret, tenant, product } = body;
86
+ const { clientID, tenant, product } = body;
86
87
 
87
- if (clientID && clientSecret) {
88
+ if (clientID) {
88
89
  const samlConfig = await configStore.get(clientID);
89
90
  if (!samlConfig) {
90
91
  return {};
package/src/jackson.js CHANGED
@@ -87,7 +87,7 @@ internalApp.post(apiPath + '/config', async (req, res) => {
87
87
  }
88
88
  });
89
89
 
90
- internalApp.get(apiPath + '/config', async (req, res) => {
90
+ internalApp.post(apiPath + '/config/get', async (req, res) => {
91
91
  try {
92
92
  const apiKey = extractAuthToken(req);
93
93
  if (!validateApiKey(apiKey)) {