Skip to content

Commit

Permalink
Upgrade to okta-auth-js 5.2.1
Browse files Browse the repository at this point in the history
OKTA-386969
<<<Jenkins Check-In of Tested SHA: 41f5812 for [email protected]>>>
Artifact: okta-angular
Files changed count: 9
PR Link: "#40"
  • Loading branch information
denys.oblohin authored and eng-prod-CI-bot-okta committed Jul 5, 2021
1 parent 4c1a8f5 commit 76ba4c9
Show file tree
Hide file tree
Showing 9 changed files with 168 additions and 12,614 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ testenv
/src/okta/packageInfo.ts
.yalc
yalc.lock
yarn-error.log
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# 3.2.0

### Other

[#40](https://github.com/okta/okta-angular/pull/40) Requires [@okta/okta-auth-js 5.x](https://github.com/okta/okta-auth-js/#from-4x-to-5x)

# 3.1.0

### Features
Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
],
"license": "Apache-2.0",
"dependencies": {
"@okta/okta-auth-js": "^4.8.0",
"@okta/okta-auth-js": "^5.2.1",
"tslib": "^1.9.0"
},
"devDependencies": {
Expand All @@ -60,7 +60,7 @@
"@rollup/plugin-node-resolve": "7.0.0",
"@types/jest": "^26.0.14",
"@types/json-schema": "^7.0.3",
"@types/node": "^14.11.2",
"@types/node": "10.14.0",
"@typescript-eslint/eslint-plugin": "^4.3.0",
"@typescript-eslint/parser": "^4.3.0",
"angular2-template-loader": "0.6.2",
Expand Down Expand Up @@ -92,7 +92,7 @@
"tsickle": "^0.39.1",
"tslint": "^6.1.3",
"typescript": "~3.2.0",
"uglify-js": "3.6.0",
"uglify-js": "3.13.5",
"webpack": "^4.32.2",
"webpack-filter-warnings-plugin": "1.2.1",
"zone.js": "~0.8.26"
Expand Down Expand Up @@ -142,4 +142,4 @@
"./",
"test/e2e/harness"
]
}
}
12 changes: 12 additions & 0 deletions scripts/update_se_drivers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,18 @@ function setChromeDriverVersion() {
86)
CHROME_DRIVER_VER=86.0.4240.22
;;
87)
CHROME_DRIVER_VER=87.0.4280.20
;;
88)
CHROME_DRIVER_VER=88.0.4324.96
;;
89)
CHROME_DRIVER_VER=89.0.4389.23
;;
90)
CHROME_DRIVER_VER=90.0.4430.24
;;
*)
CHROME_DRIVER_VER=${DEFAULT_CHROME_DRIVER_VER}
;;
Expand Down
20 changes: 16 additions & 4 deletions src/okta/services/okta.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* See the License for the specific language governing permissions and limitations under the License.
*/

import { Inject, Injectable, Optional } from '@angular/core';
import { Inject, Injectable, OnDestroy, Optional } from '@angular/core';
import { Router } from '@angular/router';

import { OKTA_CONFIG, OktaConfig } from '../models/okta.config';
Expand All @@ -35,7 +35,7 @@ import { Observable, Observer } from 'rxjs';
import { Location } from '@angular/common';

@Injectable()
export class OktaAuthService extends OktaAuth {
export class OktaAuthService extends OktaAuth implements OnDestroy {
private config: OktaConfig;
private observers: Observer<boolean>[];
private location?: Location;
Expand Down Expand Up @@ -65,7 +65,7 @@ export class OktaAuthService extends OktaAuth {
// If a router is available, provide a default implementation of `restoreOriginalUri`
const restoreOriginalUri = (!config.restoreOriginalUri && router && location) ? async (oktaAuth: OktaAuth, originalUri: string) => {
const baseUrl = window.location.origin + location.prepareExternalUrl('');
const routePath = toRelativeUrl(originalUri, baseUrl);
const routePath = toRelativeUrl(originalUri || '/', baseUrl);
return router.navigateByUrl(routePath);
} : config.restoreOriginalUri;

Expand All @@ -91,14 +91,26 @@ export class OktaAuthService extends OktaAuth {
});
if (!this.token.isLoginRedirect()) {
// Trigger an initial change event to make sure authState is latest
this.authStateManager.updateAuthState();
// Also starts the token auto-renew service
this.start();
}
}

ngOnDestroy(): void {
this.stop();
}

private async emitAuthenticationState(state: boolean) {
this.observers.forEach(observer => observer.next(state));
}

public async isAuthenticated(): Promise<boolean> {
if (this.config.isAuthenticated) {
return await this.config.isAuthenticated(this);
}
return await super.isAuthenticated();
}

async signInWithRedirect(options: SigninWithRedirectOptions = {}): Promise<void> {
const originalUri = options.originalUri || this.getOriginalUri();
if (!originalUri) {
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/harness/src/app/sessionToken-login.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export class SessionTokenLoginComponent {
password: password
})
.then(res => {
return this.okta.signInWithRedirect({
return this.okta.token.getWithRedirect({
sessionToken: res.sessionToken
});
})
Expand Down
2 changes: 1 addition & 1 deletion test/selenium-test/sign-in-widget/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export class AppComponent {
}

login() {
this.oktaAuth.signIn('/profile');
this.oktaAuth.signInWithRedirect({ originalUri: '/profile' });
}

async logout() {
Expand Down
Loading

0 comments on commit 76ba4c9

Please sign in to comment.