Search in sources :

Example 1 with GooglePublicKeysManager

use of com.google.api.client.googleapis.auth.oauth2.GooglePublicKeysManager in project molgenis by molgenis.

the class GoogleAuthenticationProcessingFilterTest method setUp.

@BeforeMethod
public void setUp() {
    authenticationSettings = mock(AuthenticationSettings.class);
    UserDetailsService userDetailsService = mock(UserDetailsService.class);
    DataService dataService = mock(DataService.class);
    GooglePublicKeysManager googlePublicKeysManager = mock(GooglePublicKeysManager.class);
    UserFactory userFactory = mock(UserFactory.class);
    GroupMemberFactory groupMemberFactory = mock(GroupMemberFactory.class);
    googleAuthenticationProcessingFilter = new GoogleAuthenticationProcessingFilter(googlePublicKeysManager, dataService, userDetailsService, authenticationSettings, userFactory, groupMemberFactory);
    request = mock(HttpServletRequest.class);
    response = mock(HttpServletResponse.class);
}
Also used : GooglePublicKeysManager(com.google.api.client.googleapis.auth.oauth2.GooglePublicKeysManager) HttpServletRequest(javax.servlet.http.HttpServletRequest) AuthenticationSettings(org.molgenis.security.settings.AuthenticationSettings) UserFactory(org.molgenis.data.security.auth.UserFactory) HttpServletResponse(javax.servlet.http.HttpServletResponse) UserDetailsService(org.molgenis.security.user.UserDetailsService) GroupMemberFactory(org.molgenis.data.security.auth.GroupMemberFactory) DataService(org.molgenis.data.DataService) BeforeMethod(org.testng.annotations.BeforeMethod)

Example 2 with GooglePublicKeysManager

use of com.google.api.client.googleapis.auth.oauth2.GooglePublicKeysManager in project molgenis by molgenis.

the class MolgenisWebAppSecurityConfig method googlePublicKeysManager.

@Bean
public GooglePublicKeysManager googlePublicKeysManager() {
    HttpTransport transport = new NetHttpTransport();
    JsonFactory jsonFactory = new JacksonFactory();
    return new GooglePublicKeysManager(transport, jsonFactory);
}
Also used : GooglePublicKeysManager(com.google.api.client.googleapis.auth.oauth2.GooglePublicKeysManager) HttpTransport(com.google.api.client.http.HttpTransport) NetHttpTransport(com.google.api.client.http.javanet.NetHttpTransport) NetHttpTransport(com.google.api.client.http.javanet.NetHttpTransport) JsonFactory(com.google.api.client.json.JsonFactory) JacksonFactory(com.google.api.client.json.jackson2.JacksonFactory) Bean(org.springframework.context.annotation.Bean)

Example 3 with GooglePublicKeysManager

use of com.google.api.client.googleapis.auth.oauth2.GooglePublicKeysManager in project molgenis by molgenis.

the class GoogleAuthenticationProcessingFilter method verify.

private GoogleIdToken verify(String idTokenString) throws GeneralSecurityException, IOException {
    List<String> audience = Collections.singletonList(authenticationSettings.getGoogleAppClientId());
    GoogleIdTokenVerifier googleIdTokenVerifier = new GoogleIdTokenVerifier.Builder(googlePublicKeysManager).setAudience(audience).build();
    return googleIdTokenVerifier.verify(idTokenString);
}
Also used : GoogleIdTokenVerifier(com.google.api.client.googleapis.auth.oauth2.GoogleIdTokenVerifier)

Aggregations

GooglePublicKeysManager (com.google.api.client.googleapis.auth.oauth2.GooglePublicKeysManager)2 GoogleIdTokenVerifier (com.google.api.client.googleapis.auth.oauth2.GoogleIdTokenVerifier)1 HttpTransport (com.google.api.client.http.HttpTransport)1 NetHttpTransport (com.google.api.client.http.javanet.NetHttpTransport)1 JsonFactory (com.google.api.client.json.JsonFactory)1 JacksonFactory (com.google.api.client.json.jackson2.JacksonFactory)1 HttpServletRequest (javax.servlet.http.HttpServletRequest)1 HttpServletResponse (javax.servlet.http.HttpServletResponse)1 DataService (org.molgenis.data.DataService)1 GroupMemberFactory (org.molgenis.data.security.auth.GroupMemberFactory)1 UserFactory (org.molgenis.data.security.auth.UserFactory)1 AuthenticationSettings (org.molgenis.security.settings.AuthenticationSettings)1 UserDetailsService (org.molgenis.security.user.UserDetailsService)1 Bean (org.springframework.context.annotation.Bean)1 BeforeMethod (org.testng.annotations.BeforeMethod)1