Skip to content

Commit

Permalink
remove PKCE flow test
Browse files Browse the repository at this point in the history
OKTA-324375
<<<Jenkins Check-In of Tested SHA: 30f12eb for [email protected]>>>
Artifact: okta-angular
  • Loading branch information
denysoblohin-okta authored and eng-prod-CI-bot-okta committed Mar 6, 2021
1 parent cc5b05e commit f3abc0b
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 75 deletions.
64 changes: 0 additions & 64 deletions test/e2e/harness/e2e/app.e2e-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,70 +99,6 @@ describe('Angular + Okta App', () => {
});
});


describe('PKCE flow', () => {
it('should redirect to Okta for login when trying to access a protected page', () => {
protectedPage.navigateTo('?pkce=1');
oktaLoginPage.waitUntilVisible(process.env.ISSUER);
oktaLoginPage.signIn({
username: process.env.USERNAME,
password: process.env.PASSWORD
});

protectedPage.waitUntilVisible('?pkce=1');
expect(protectedPage.getLogoutButton().isPresent()).toBeTruthy();

// Verify the user object was returned
protectedPage.waitUntilTextVisible('userinfo-container', 'email');
protectedPage.getUserInfo().getText()
.then(userInfo => {
expect(userInfo).toContain('email');
});

// Logout
protectedPage.getLogoutButton().click();
protectedPage.waitForElement('login-button');
expect(protectedPage.getLoginButton().isPresent()).toBeTruthy();
});

it('should preserve query paramaters after redirecting to Okta', () => {
protectedPage.navigateTo('/foo?state=bar&pkce=1');

oktaLoginPage.waitUntilVisible(process.env.ISSUER);
oktaLoginPage.signIn({
username: process.env.USERNAME,
password: process.env.PASSWORD
});

protectedPage.waitUntilVisible('/foo?state=bar&pkce=1');
expect(protectedPage.getLogoutButton().isPresent()).toBeTruthy();

// Logout
protectedPage.getLogoutButton().click();
protectedPage.waitForElement('login-button');
expect(protectedPage.getLoginButton().isPresent()).toBeTruthy();
});

it('should redirect to Okta for login', () => {
loginPage.navigateTo();

oktaLoginPage.waitUntilVisible(process.env.ISSUER);
oktaLoginPage.signIn({
username: process.env.USERNAME,
password: process.env.PASSWORD
});

loginPage.waitUntilLoggedIn();
expect(loginPage.getLogoutButton().isPresent()).toBeTruthy();

// Logout
loginPage.getLogoutButton().click();
loginPage.waitForElement('login-button');
expect(loginPage.getLoginButton().isPresent()).toBeTruthy();
});
});


describe('session token login', () => {

it('should allow passing sessionToken to skip Okta login', () => {
Expand Down
12 changes: 1 addition & 11 deletions test/e2e/harness/src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,6 @@ const appRoutes: Routes = [
path: 'login/callback',
component: OktaCallbackComponent
},
{
path: 'pkce/callback',
component: OktaCallbackComponent
},
{
path: 'protected',
component: ProtectedComponent,
Expand Down Expand Up @@ -94,16 +90,10 @@ const appRoutes: Routes = [
}
];

// To perform end-to-end PKCE flow we must be configured on both ends: when the login is initiated, and on the callback
// The login page is loaded with a query param. This will select a unique callback url
// On the callback load we detect PKCE by inspecting the pathname
const url = new URL(window.location.href);
const pkce = !!url.searchParams.get('pkce') || url.pathname.indexOf('pkce/callback') >= 0;
const redirectUri = window.location.origin + (pkce ? '/pkce/callback' : '/login/callback');
const redirectUri = window.location.origin + '/login/callback';

const config = {
issuer: process.env.ISSUER,
pkce,
redirectUri,
clientId: process.env.CLIENT_ID,
onAuthRequired: onNeedsGlobalAuthenticationGuard,
Expand Down

0 comments on commit f3abc0b

Please sign in to comment.