1
0
mirror of https://github.com/sasjs/adapter.git synced 2026-01-14 23:50:06 +00:00

fix: sas9 public access denied handling

This commit is contained in:
2022-09-07 18:34:45 +02:00
parent 16185eba4d
commit e6ec51c7eb
3 changed files with 27 additions and 2 deletions

View File

@@ -136,7 +136,17 @@ export class AuthManager {
if (isLoggedIn) {
if (this.serverType === ServerType.Sas9) {
await this.performCASSecurityCheck()
const casSecurityCheckResponse = await this.performCASSecurityCheck()
if (isPublicAccessDenied(casSecurityCheckResponse.result)) {
isLoggedIn = false
return {
isLoggedIn,
userName: this.userName || '',
errorMessage: 'Public access has been denied.'
}
}
}
this.loginCallback()
@@ -151,7 +161,7 @@ export class AuthManager {
private async performCASSecurityCheck() {
const casAuthenticationUrl = `${this.serverUrl}/SASStoredProcess/j_spring_cas_security_check`
await this.requestClient.get<string>(
return await this.requestClient.get<string>(
`/SASLogon/login?service=${casAuthenticationUrl}`,
undefined
)
@@ -361,3 +371,7 @@ const isLogInSuccess = (serverType: ServerType, response: any): boolean => {
return /You have signed in/gm.test(response)
}
const isPublicAccessDenied = (response: any): boolean => {
return /Public access has been denied/gm.test(response)
}