Search in sources :

Example 1 with TestIdentityServer

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);
}
Also used : TestIdentityServer(com.nexblocks.authguard.jwt.oauth.TestIdentityServer) SessionsService(com.nexblocks.authguard.service.SessionsService) AccountsService(com.nexblocks.authguard.service.AccountsService) ImmutableOAuthConfiguration(com.nexblocks.authguard.jwt.oauth.config.ImmutableOAuthConfiguration)

Aggregations

TestIdentityServer (com.nexblocks.authguard.jwt.oauth.TestIdentityServer)1 ImmutableOAuthConfiguration (com.nexblocks.authguard.jwt.oauth.config.ImmutableOAuthConfiguration)1 AccountsService (com.nexblocks.authguard.service.AccountsService)1 SessionsService (com.nexblocks.authguard.service.SessionsService)1