Skip to content

Commit

Permalink
Merge pull request #834 from sasjs/redirectLogin-fix
Browse files Browse the repository at this point in the history
fix(auth-manager): fixed redirectedLoginUrl
  • Loading branch information
YuryShkoda committed Feb 19, 2024
2 parents 10da691 + 8c64c24 commit 4c45119
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@ jobs:
node-version: ${{ matrix.node-version }}
cache: npm

- name: Check npm audit
run: npm audit --production --audit-level=low
# FIXME: uncomment 'Check npm audit' step after axios version bump
# - name: Check npm audit
# run: npm audit --production --audit-level=low

- name: Install Dependencies
run: npm ci
Expand Down
3 changes: 3 additions & 0 deletions src/auth/AuthManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export class AuthManager {
private loginUrl: string
private logoutUrl: string
private redirectedLoginUrl = `/SASLogon` //SAS 9 M8 no longer redirects from `/SASLogon/home` to the login page. `/SASLogon` seems to be stable enough across SAS versions

constructor(
private serverUrl: string,
private serverType: ServerType,
Expand All @@ -27,6 +28,8 @@ export class AuthManager {
: this.serverType === ServerType.SasViya
? '/SASLogon/logout.do?'
: '/SASLogon/logout'

this.redirectedLoginUrl = this.serverUrl + this.redirectedLoginUrl
}

/**
Expand Down
8 changes: 4 additions & 4 deletions src/auth/spec/AuthManager.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ describe('AuthManager', () => {
expect(loginResponse.userName).toEqual(userName)

expect(openWebPageModule.openWebPage).toHaveBeenCalledWith(
`/SASLogon`,
`${serverUrl}/SASLogon`,
'SASLogon',
{
width: 500,
Expand Down Expand Up @@ -409,7 +409,7 @@ describe('AuthManager', () => {
expect(loginResponse.userName).toEqual(userName)

expect(openWebPageModule.openWebPage).toHaveBeenCalledWith(
`/SASLogon`,
`${serverUrl}/SASLogon`,
'SASLogon',
{
width: 500,
Expand Down Expand Up @@ -453,7 +453,7 @@ describe('AuthManager', () => {
expect(loginResponse.userName).toEqual('')

expect(openWebPageModule.openWebPage).toHaveBeenCalledWith(
`/SASLogon`,
`${serverUrl}/SASLogon`,
'SASLogon',
{
width: 500,
Expand Down Expand Up @@ -497,7 +497,7 @@ describe('AuthManager', () => {
expect(loginResponse.userName).toEqual('')

expect(openWebPageModule.openWebPage).toHaveBeenCalledWith(
`/SASLogon`,
`${serverUrl}/SASLogon`,
'SASLogon',
{
width: 500,
Expand Down

0 comments on commit 4c45119

Please sign in to comment.