use of com.nexblocks.authguard.jwt.oauth.TestIdentityServer in project AuthGuard by AuthGuard.
the class OAuthServiceTest method setup.
@BeforeAll
void setup() {
testIdentityServer = new TestIdentityServer();
testIdentityServer.start();
clientConfiguration = ImmutableOAuthClientConfiguration.builder().provider("test").authUrl("http://localhost:" + testIdentityServer.getPort() + "/auth").tokenUrl("http://localhost:" + testIdentityServer.getPort() + "/token").authRedirectUrl("http://localhost/redirect").tokenRedirectUrl("http://localhost/redirect").clientId("unit-tests").clientSecret("secret").addDefaultScopes("openid", "profile").build();
accountProviderClientConfiguration = ImmutableOAuthClientConfiguration.builder().provider("account_test").authUrl("http://localhost:" + testIdentityServer.getPort() + "/auth").tokenUrl("http://localhost:" + testIdentityServer.getPort() + "/token").authRedirectUrl("http://localhost/redirect").tokenRedirectUrl("http://localhost/redirect").clientId("unit-tests").clientSecret("secret").addDefaultScopes("openid", "profile").accountProvider(true).emailField("email").build();
final ImmutableOAuthConfiguration oAuthConfiguration = ImmutableOAuthConfiguration.builder().addClients(clientConfiguration).addClients(accountProviderClientConfiguration).build();
sessionsService = Mockito.mock(SessionsService.class);
accountsService = Mockito.mock(AccountsService.class);
oAuthService = new OAuthService(oAuthConfiguration, sessionsService, accountsService);
}
Aggregations