Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ services:
- APPLICATION_INTERNAL_ASSERTION_SERVICE_ID=assertion-service-internal
- APPLICATION_INTERNAL_ASSERTION_SERVICE_CLIENT_SECRET=${ASSERTION_SERVICE_INTERNAL_CLIENT_SECRET}
- APPLICATION_SECURITY_ISSUER_URL=${ISSUER_URL}
- UI_REDIRECT_URI=${UI_BASE_URL}/auth/callback
- UI_REDIRECT_URI=${UI_BASE_URL}/en/auth/callback
- UI_POST_LOGOUT_REDIRECT_URI=${UI_BASE_URL}/en/login
volumes:
- ${LOG_VOLUME:-/var/tmp/}:/logs
Expand Down
2 changes: 2 additions & 0 deletions ui-2/src/app/account/auth.guard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

import { StateStorageService } from './service/state-storage.service'
import { AccountService } from './service/account.service'
import { log } from 'console'

Check warning on line 9 in ui-2/src/app/account/auth.guard.ts

View workflow job for this annotation

GitHub Actions / format-ui-2

'log' is defined but never used

export const AuthGuard = (route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<boolean> | boolean => {
const authorities = route.data['authorities']
Expand All @@ -23,6 +24,7 @@
if (state.url === '/login') {
return of(true)
}
console.log('storing state url for redirect after login:', state.url)
stateStorageService.storeUrl(state.url)
router.navigate(['/login'])
return of(false)
Expand Down
3 changes: 1 addition & 2 deletions ui-2/src/app/account/login/login.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import { AccountService } from '../service/account.service'
import { LoginService } from '../service/login.service'
import { StateStorageService } from '../service/state-storage.service'
import { Subscription, filter, take } from 'rxjs'

Check warning on line 7 in ui-2/src/app/account/login/login.component.ts

View workflow job for this annotation

GitHub Actions / format-ui-2

'take' is defined but never used

Check warning on line 7 in ui-2/src/app/account/login/login.component.ts

View workflow job for this annotation

GitHub Actions / format-ui-2

'filter' is defined but never used
import { EventService } from 'src/app/shared/service/event.service'
import { EventType } from 'src/app/app.constants'
import { Event } from 'src/app/shared/model/event.model'
Expand Down Expand Up @@ -40,7 +40,7 @@
private eventService: EventService,
private ngZone: NgZone
) {
this.sub = this.eventService.on(EventType.LOG_IN_SUCCESS).subscribe((e) => {

Check warning on line 43 in ui-2/src/app/account/login/login.component.ts

View workflow job for this annotation

GitHub Actions / format-ui-2

'e' is defined but never used
console.log('login success')
})
}
Expand All @@ -67,7 +67,7 @@
this.mfaError = false

const credentials: ILoginCredentials = {
username: this.loginForm.get('username')!.value!,

Check warning on line 70 in ui-2/src/app/account/login/login.component.ts

View workflow job for this annotation

GitHub Actions / format-ui-2

Forbidden non-null assertion
password: this.loginForm.get('password')!.value!,
mfaCode: this.loginForm.get('mfaCode')?.value,
}
Expand Down Expand Up @@ -106,10 +106,9 @@

this.eventService.broadcast(new Event(EventType.LOG_IN_SUCCESS))

// previousState was set in the authExpiredInterceptor before being redirected to login modal.
// since login is successful, go to stored previousState and clear previousState
const redirect = this.stateStorageService.getUrl()
if (redirect) {
console.log('Redirecting to stored url after login:', redirect)
this.stateStorageService.storeUrl(null)
this.router.navigateByUrl(redirect)
}
Expand Down
4 changes: 4 additions & 0 deletions ui-2/src/app/app-routing.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ import { AppComponent } from './app.component'
import { LoginComponent } from './account'

const routes: Routes = [
{
path: 'auth/callback',
children: [],
},
{
path: '',
loadChildren: () => import('./account/account.module').then((m) => m.AccountModule),
Expand Down
4 changes: 3 additions & 1 deletion ui-2/src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,10 @@ export class AppComponent implements OnInit {
const redirect = this.stateStorageService.getUrl()
if (redirect) {
this.stateStorageService.storeUrl(null)
console.log('Redirecting to stored url after login:', redirect)
this.router.navigateByUrl(redirect)
} else if (this.router.url.includes('login/callback')) {
} else if (this.router.url.includes('auth/callback')) {
console.log('Oauth callback, navigating to home page after login')
this.router.navigate(['/'])
}
})
Expand Down
2 changes: 1 addition & 1 deletion ui-2/src/environments/environment.prod.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export const environment = {
production: true,
issuerUrl: (window as any).__env?.issuerUrl || 'http://localhost:9000',
redirectUri: window.location.origin + '/auth/callback',
redirectUri: window.location.origin + '/en/auth/callback',
postLogoutRedirectUri: window.location.origin + '/en/login',
}
Loading