Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,10 @@
.nyc_output
.vscode

.yarn/*
!.yarn/patches
!.yarn/releases
!.yarn/plugins
!.yarn/sdks
!.yarn/versions
.pnp.*
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
10.15.2
lts/gallium
786 changes: 786 additions & 0 deletions .yarn/releases/yarn-3.2.1.cjs

Large diffs are not rendered by default.

10 changes: 10 additions & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
nodeLinker: node-modules

npmPublishRegistry: "https://registry-197565871292.d.codeartifact.us-east-1.amazonaws.com/npm/registry/"

npmScopes:
classy:
npmAlwaysAuth: true
npmAuthToken: "${CODEARTIFACT_AUTH_TOKEN}"
npmRegistryServer: "https://registry-197565871292.d.codeartifact.us-east-1.amazonaws.com/npm/registry/"

4 changes: 4 additions & 0 deletions ca-login.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
echo "Make sure you are sourcing (rather than running) this script in order to load the token into the current environment"
echo "Fetching codeartifact token..."
export CODEARTIFACT_AUTH_TOKEN=`aws codeartifact get-authorization-token --domain registry --domain-owner 197565871292 --query authorizationToken --output text --region us-east-1 "$@"`
echo "Done."
1 change: 1 addition & 0 deletions docs/resources.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Resources

## Activity

Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "classy-node",
"name": "@classy/classy-node",
"version": "3.2.1",
"description": "Classy API wrapper",
"scripts": {
Expand Down Expand Up @@ -78,5 +78,6 @@
"snyk": "^1.15.0",
"strip-indent": "^3.0.0",
"v8flags": "^3.1.3"
}
},
"packageManager": "yarn@3.2.1"
}
8 changes: 8 additions & 0 deletions src/Classy/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,14 @@ class Classy {
DEFAULT_STRICT_SSL
);

// This is Gatewayurl to support Okta token. In case of Okta token, all api calls using member token should
// go from Gateway url
this.gatewayUrl = (
!_.isUndefined(config.gatewayUrl) ?
config.gatewayUrl :
''
);

/**
* Add the ability to define an error logger.
*
Expand Down
7 changes: 7 additions & 0 deletions src/ClassyResource/createMethod.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ export default function createMethod(spec) {
};

let requestHeaders = this._classy.headers || _.merge(DEFAULT_REQUEST_HEADERS, spec.headers);
this.baseUrl = this._classy.baseUrl;

if (requestMethod == 'POST'
|| requestMethod == 'PUT'
Expand All @@ -87,6 +88,12 @@ export default function createMethod(spec) {
}

if (response === 'member') {

// This flags suggested that access token created from Okta and baseUrl should be Gateway URL like AWSGatewayUrl
if (_.get(data, 'token.is_okta_token', false)) {
this.baseUrl = this._classy.gatewayUrl;
}

const memberToken = _.get(data, 'token.access_token', false);
delete data.token;

Expand Down
Loading