diff --git a/smp-angular/src/app/security/security.service.ts b/smp-angular/src/app/security/security.service.ts index 02210b828f37b12a9501550c6ceb23a9a0335431..db7c512b57b7b05e41cc9917c697feaf9b4443aa 100644 --- a/smp-angular/src/app/security/security.service.ts +++ b/smp-angular/src/app/security/security.service.ts @@ -17,7 +17,6 @@ export class SecurityService { private http: HttpClient, private alertService: AlertMessageService, private securityEventService: SecurityEventService, - private lookups: GlobalLookups ) { this.securityEventService.onLogoutSuccessEvent().subscribe(() => window.location.reload()); this.securityEventService.onLogoutErrorEvent().subscribe((error) => this.alertService.error(error)); diff --git a/smp-webapp/src/main/java/eu/europa/ec/edelivery/smp/auth/SMPAuthorizationService.java b/smp-webapp/src/main/java/eu/europa/ec/edelivery/smp/auth/SMPAuthorizationService.java index 92c8718db69aae7076503be925c7bea25e4fb899..3ac7d6209c02cedff4fb3d28db6b28f83ec17df7 100644 --- a/smp-webapp/src/main/java/eu/europa/ec/edelivery/smp/auth/SMPAuthorizationService.java +++ b/smp-webapp/src/main/java/eu/europa/ec/edelivery/smp/auth/SMPAuthorizationService.java @@ -9,6 +9,7 @@ import eu.europa.ec.edelivery.smp.services.ServiceGroupService; import eu.europa.ec.edelivery.smp.utils.SessionSecurityUtils; import org.apache.commons.lang3.StringUtils; import org.springframework.security.authentication.BadCredentialsException; +import org.springframework.security.cas.authentication.CasAuthenticationToken; import org.springframework.security.core.Authentication; import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.security.web.authentication.session.SessionAuthenticationException; @@ -91,7 +92,7 @@ public class SMPAuthorizationService { return userRO; } - private SMPAuthenticationToken getSessionAuthentication() { + private Authentication getSessionAuthentication() { if (SecurityContextHolder.getContext() == null) { LOG.warn("No users is logged-in! Session security context is null!"); return null; @@ -101,15 +102,16 @@ public class SMPAuthorizationService { LOG.warn("No users is logged-in! Authentication is null or not authenticated!"); return null; } - if (!(authentication instanceof SMPAuthenticationToken)) { + if (!(authentication instanceof SMPAuthenticationToken + || authentication instanceof CasAuthenticationToken)) { LOG.warn("User is logged and authenticated with not supported Authentication [{}]!", authentication.getClass()); return null; } - return (SMPAuthenticationToken) authentication; + return authentication; } - private SMPAuthenticationToken getAndValidateSessionAuthentication() { - SMPAuthenticationToken authentication = getSessionAuthentication(); + private Authentication getAndValidateSessionAuthentication() { + Authentication authentication = getSessionAuthentication(); if (authentication == null) { throw new SessionAuthenticationException(ERR_INVALID_OR_NULL); }