@Test void givenZosmfToken_whenCreateCommand_thenTestJwtToken() { AuthConfigurationProperties.CookieProperties cookieProperties = mock(AuthConfigurationProperties.CookieProperties.class); when(cookieProperties.getCookieName()).thenReturn("apimlAuthenticationToken"); when(authConfigurationProperties.getCookieProperties()).thenReturn(cookieProperties); ZosmfScheme scheme = new ZosmfScheme(authenticationService, authConfigurationProperties); QueryResponse queryResponse = new QueryResponse("domain", "username", new Date(), new Date(), QueryResponse.Source.ZOSMF); when(authenticationService.getJwtTokenFromRequest(any())).thenReturn(Optional.of("jwtTokenZosmf")); when(authenticationService.parseJwtToken("jwtTokenZosmf")).thenReturn(queryResponse); AuthenticationCommand command = scheme.createCommand(new Authentication(AuthenticationScheme.ZOSMF, null), () -> queryResponse); command.apply(null); verify(authenticationService, times(1)).getJwtTokenFromRequest(any()); verify(authenticationService, times(1)).parseJwtToken("jwtTokenZosmf"); verify(authenticationService, never()).getLtpaTokenWithValidation("jwtTokenZosmf"); }
@Override public AuthenticationCommand createCommand(Authentication authentication, Supplier<QueryResponse> tokenSupplier) { final QueryResponse queryResponse = tokenSupplier.get(); final Date expiration = queryResponse == null ? null : queryResponse.getExpiration(); final Long expirationTime = expiration == null ? null : expiration.getTime(); return new ZosmfCommand(expirationTime); }
ZosmfScheme implements AbstractAuthenticationScheme { @Override public AuthenticationCommand createCommand(Authentication authentication, Supplier<QueryResponse> tokenSupplier) { final QueryResponse queryResponse = tokenSupplier.get(); final Date expiration = queryResponse == null ? null : queryResponse.getExpiration(); final Long expirationTime = expiration == null ? null : expiration.getTime(); return new ZosmfCommand(expirationTime); } }
ZosmfScheme implements AbstractAuthenticationScheme { @Override public AuthenticationCommand createCommand(Authentication authentication, Supplier<QueryResponse> tokenSupplier) { final QueryResponse queryResponse = tokenSupplier.get(); final Date expiration = queryResponse == null ? null : queryResponse.getExpiration(); final Long expirationTime = expiration == null ? null : expiration.getTime(); return new ZosmfCommand(expirationTime); }  }
ZosmfScheme implements AbstractAuthenticationScheme { @Override public AuthenticationCommand createCommand(Authentication authentication, Supplier<QueryResponse> tokenSupplier) { final QueryResponse queryResponse = tokenSupplier.get(); final Date expiration = queryResponse == null ? null : queryResponse.getExpiration(); final Long expirationTime = expiration == null ? null : expiration.getTime(); return new ZosmfCommand(expirationTime); }  @Override AuthenticationScheme getScheme(); @Override AuthenticationCommand createCommand(Authentication authentication, Supplier<QueryResponse> tokenSupplier); }
ZosmfScheme implements AbstractAuthenticationScheme { @Override public AuthenticationCommand createCommand(Authentication authentication, Supplier<QueryResponse> tokenSupplier) { final QueryResponse queryResponse = tokenSupplier.get(); final Date expiration = queryResponse == null ? null : queryResponse.getExpiration(); final Long expirationTime = expiration == null ? null : expiration.getTime(); return new ZosmfCommand(expirationTime); }  @Override AuthenticationScheme getScheme(); @Override AuthenticationCommand createCommand(Authentication authentication, Supplier<QueryResponse> tokenSupplier);  }