Skip to content

Commit

Permalink
Update OAuth2 property names to camelCase
Browse files Browse the repository at this point in the history
 This commit updates the OAuth2 property names to use camelCase instead of snake_case to maintain consistency with JavaScript naming conventions. The changes include updating the property names in the
 HTML, JSON locale files, and the JavaScript backend code. The affected properties are `grant_type`, `access_token_url`, `authorization_endpoint`, `redirect_uri`, `open_authentication`, `client_id`,
 `client_secret`, and `client_credentials_in_body`, which have been changed to `grantType`, `accessTokenUrl`, `authorizationEndpoint`, `redirectUri`, `openAuthentication`, `clientId`, `clientSecret`, and
 `clientCredentialsInBody`, respectively. Additionally, the commit includes updates to the corresponding labels and placeholders in the UI components.
  • Loading branch information
caputomarcos committed May 20, 2024
1 parent 9761d0b commit c6d0ae7
Show file tree
Hide file tree
Showing 7 changed files with 183 additions and 183 deletions.
44 changes: 22 additions & 22 deletions README.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion examples/Sandbox PayPal - Client Credentials.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion examples/node-red-contrib-oauth2.json

Large diffs are not rendered by default.

42 changes: 21 additions & 21 deletions src/locales/en-US/oauth2.html
Original file line number Diff line number Diff line change
Expand Up @@ -76,21 +76,21 @@

The client credentials can be sent as part of the message payload to the node. The `msg.oauth2Request.credentials` object should contain the following properties:

- `grant_type` (string): This specifies the grant type. For dynamic credentials, the value should be set to "client_credentials".
- `client_id` (string): This is the client ID of the OAuth2 client.
- `client_secret` (string): This is the client secret of the OAuth2 client.
- `grantType` (string): This specifies the grant type. For dynamic credentials, the value should be set to "clientCredentials".
- `clientId` (string): This is the client ID of the OAuth2 client.
- `clientSecret` (string): This is the client secret of the OAuth2 client.
- `scope` (string): This specifies the scope of the access requested.
- `resource` (string): This specifies the resource of the access requested.

Here's an example:

```js
msg.oauth2Request = {
access_token_url: 'http://localhost:8080/v1/oauth/tokens',
accessTokenUrl: 'http://localhost:8080/v1/oauth/tokens',
credentials: {
grant_type: 'client_credentials',
client_id: 'test_client_1',
client_secret: 'test_secret',
grantType: 'clientCredentials',
clientId: 'test_client_1',
clientSecret: 'test_secret',
scope: 'read_write',
resource: 'http://localhost:8080'
}
Expand All @@ -102,9 +102,9 @@

The username and password can be sent as part of the message payload to the node. The `msg.oauth2Request.credentials` object should contain the following properties:

- `grant_type` (string): This specifies the grant type. For password credentials, the value should be set to "password".
- `client_id` (string): This is the client ID of the OAuth2 client.
- `client_secret` (string): This is the client secret of the OAuth2 client.
- `grantType` (string): This specifies the grant type. For password credentials, the value should be set to "password".
- `clientId` (string): This is the client ID of the OAuth2 client.
- `clientSecret` (string): This is the client secret of the OAuth2 client.
- `scope` (string): This specifies the scope of the access requested.
- `resource` (string): This specifies the resource of the access requested.
- `username` (string): This is the username of the user.
Expand All @@ -114,11 +114,11 @@

```js
msg.oauth2Request = {
access_token_url: 'http://localhost:8080/v1/oauth/tokens',
accessTokenUrl: 'http://localhost:8080/v1/oauth/tokens',
credentials: {
grant_type: 'password',
client_id: 'test_client_1',
client_secret: 'test_secret',
grantType: 'password',
clientId: 'test_client_1',
clientSecret: 'test_secret',
scope: 'read_write',
resource: 'http://localhost:8080',
username: 'test@user',
Expand All @@ -132,9 +132,9 @@

A refresh token can be used to obtain a new access token without requiring the user to re-authenticate. The `msg.oauth2Request.credentials` object should contain the following properties:

- `grant_type` (string): This specifies the grant type. For refresh token credentials, the value should be set to "refresh_token".
- `client_id` (string): This is the client ID of the OAuth2 client.
- `client_secret` (string): This is the client secret of the OAuth2 client.
- `grantType` (string): This specifies the grant type. For refresh token credentials, the value should be set to "refresh_token".
- `clientId` (string): This is the client ID of the OAuth2 client.
- `clientSecret` (string): This is the client secret of the OAuth2 client.
- `scope` (string): This specifies the scope of the access requested.
- `resource` (string): This specifies the resource of the access requested.
- `refresh_token` (string): This is the refresh token obtained from a previous authentication.
Expand All @@ -145,11 +145,11 @@
let refreshToken = global.get('refreshToken');
msg.oauth2Request = {
access_token_url: 'http://localhost:8080/v1/oauth/tokens',
accessTokenUrl: 'http://localhost:8080/v1/oauth/tokens',
credentials: {
grant_type: 'refresh_token',
client_id: 'test_client_1',
client_secret: 'test_secret',
grantType: 'refresh_token',
clientId: 'test_client_1',
clientSecret: 'test_secret',
scope: 'read_write',
resource: 'http://localhost:8080',
refresh_token: refreshToken
Expand Down
38 changes: 19 additions & 19 deletions src/locales/en-US/oauth2.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,50 +2,50 @@
"oauth2": {
"oauth2": "oauth2",
"label": {
"grant_type": "Grant Type",
"grantType": "Grant Type",
"name": "Name",
"container": "Container",
"access_token_url": "Access Token URL",
"authorization_endpoint": "Authorization Endpoint",
"redirect_uri": "Redirect URI",
"open_authentication": "Code",
"accessTokenUrl": "Access Token URL",
"authorizationEndpoint": "Authorization Endpoint",
"redirectUri": "Redirect URI",
"openAuthentication": "Code",
"username": "Username",
"password": "Password",
"client_id": "Client ID",
"client_secret": "Client Secret",
"clientId": "Client ID",
"clientSecret": "Client Secret",
"scope": "Scope",
"resource": "Resource",
"state": "State",
"rejectUnauthorized": "The rejectUnauthorized parameter controls SSL/TLS certificate validation for the server, with true enforcing validation and false disabling it.",
"rejectUnauthorized_label": "Reject Unauthorized",
"client_credentials_in_body": "Ensure that the client credentials are included in the token request body for authentication purposes.",
"client_credentials_in_body_label": "Embedded Credentials",
"clientCredentialsInBody": "Ensure that the client credentials are included in the token request body for authentication purposes.",
"clientCredentialsInBody_label": "Embedded Credentials",
"proxy-config": "Proxy Configuration",
"use-proxy": "Use proxy",
"senderr": "Only send non-2xx responses to Catch node"
},
"placeholder": {
"name": "oauth2",
"container": "oauth2Response",
"access_token_url": "https://github.com/login/oauth/access_token",
"authorization_endpoint": "https://github.com/login/oauth/authorize",
"redirect_uri": "/oauth2/redirect",
"open_authentication": "1b897416-3de3-4631-a0e9-7f7431e1a959",
"accessTokenUrl": "https://github.com/login/oauth/access_token",
"authorizationEndpoint": "https://github.com/login/oauth/authorize",
"redirectUri": "/oauth2/redirect",
"openAuthentication": "1b897416-3de3-4631-a0e9-7f7431e1a959",
"username": "admin",
"password": "admin",
"client_id": "012493af6282be51660dbc8e21a8462e",
"client_secret": "5621bd4b5a8b09ed31817efb8d54fda2c72bfc1c6968cd4563d83f7cc26f68f6",
"clientId": "012493af6282be51660dbc8e21a8462e",
"clientSecret": "5621bd4b5a8b09ed31817efb8d54fda2c72bfc1c6968cd4563d83f7cc26f68f6",
"scope": "scope",
"resource": "resource",
"state": "state",
"rejectUnauthorized": "rejectUnauthorized",
"headers": "headers"
},
"opts": {
"client_credentials": "Client Credentials",
"password_credentials": "Password",
"authorization_code": "Authorization Code",
"set_by_credentials": "- Set by msg.oauth2Request -"
"clientCredentials": "Client Credentials",
"passwordCredentials": "Password",
"authorizationCode": "Authorization Code",
"setByCredentials": "- Set by msg.oauth2Request -"
}
}
}
Loading

0 comments on commit c6d0ae7

Please sign in to comment.