Skip to content

Commit

Permalink
Adjusts -admin validation check (#1513)
Browse files Browse the repository at this point in the history
OKTA-720755 fix: updates issuer validation
  • Loading branch information
jaredperreault-okta authored Apr 23, 2024
1 parent 7af0a83 commit 6ff9711
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,15 @@
## 7.6.0

### Features

- [#1507](https://github.com/okta/okta-auth-js/pull/1507) add: new method `getOrRenewAccessToken`
- [#1505](https://github.com/okta/okta-auth-js/pull/1505) add: support of `revokeSessions` param for `OktaPassword` authenticator (can be used in `reset-authenticator` remediation)
- [#1512](https://github.com/okta/okta-auth-js/pull/1512) add: new service `RenewOnTabActivation`

### Bug Fix

- [#1513](https://github.com/okta/okta-auth-js/pull/1513) fix: restricts `issuer` "-admin" validation to `.okta` domain

## 7.5.1

### Bug Fix
Expand Down
2 changes: 1 addition & 1 deletion lib/oidc/options/OAuthOptionsConstructor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ function assertValidConfig(args) {
'Required usage: new OktaAuth({issuer: "https://{yourOktaDomain}.com/oauth2/{authServerId}"})');
}

if (issuer.indexOf('-admin.') !== -1) {
if (issuer.indexOf('-admin.okta') !== -1) {
throw new AuthSdkError('Issuer URL passed to constructor contains "-admin" in subdomain. ' +
'Required usage: new OktaAuth({issuer: "https://{yourOktaDomain}.com})');
}
Expand Down
6 changes: 5 additions & 1 deletion test/spec/OktaAuth/assertValidConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ describe('assertValidConfig', () => {
'Required usage: new OktaAuth({issuer: "https://{yourOktaDomain}.com/oauth2/{authServerId}"})');
});

it('throw an error if url contains "-admin" when passed to the constructor', function () {
it('throw an error if url on the okta domain contains "-admin" when passed to the constructor', function () {
var err;
try {
new OktaAuth({issuer: 'https://dev-12345-admin.oktapreview.com'}); // eslint-disable-line no-new
Expand All @@ -65,4 +65,8 @@ describe('assertValidConfig', () => {
'Required usage: new OktaAuth({issuer: "https://{yourOktaDomain}.com})');
});

it('should not throw an error if url contains "-admin" on a domain other than .okta when passed to the constructor', function () {
// eslint-disable-next-line no-new
expect(() => new OktaAuth({issuer: 'https://login-admin.foobar.com'})).not.toThrowError();
});
});

0 comments on commit 6ff9711

Please sign in to comment.