diff --git a/services/src/test/java/io/scalecube/services/sut/security/SecuredServiceImpl.java b/services/src/test/java/io/scalecube/services/sut/security/SecuredServiceImpl.java index 9151c9643..942fb7179 100644 --- a/services/src/test/java/io/scalecube/services/sut/security/SecuredServiceImpl.java +++ b/services/src/test/java/io/scalecube/services/sut/security/SecuredServiceImpl.java @@ -1,5 +1,6 @@ package io.scalecube.services.sut.security; +import io.scalecube.services.auth.Authenticator; import io.scalecube.services.exceptions.ForbiddenException; import reactor.core.publisher.Mono; @@ -12,7 +13,8 @@ public Mono helloWithRequest(String name) { @Override public Mono helloWithPrincipal() { - return Mono.deferWithContext(context -> Mono.just(context.get(UserProfile.class))) + return Mono.deferWithContext(context -> Mono.just(context.get(Authenticator.AUTH_CONTEXT_KEY))) + .cast(UserProfile.class) .flatMap( user -> { checkPrincipal(user); @@ -22,7 +24,8 @@ public Mono helloWithPrincipal() { @Override public Mono helloWithRequestAndPrincipal(String name) { - return Mono.deferWithContext(context -> Mono.just(context.get(UserProfile.class))) + return Mono.deferWithContext(context -> Mono.just(context.get(Authenticator.AUTH_CONTEXT_KEY))) + .cast(UserProfile.class) .flatMap( user -> { checkPrincipal(user);