Search in sources :

Example 1 with SecurityContextFilter

use of oauth2.thirdparty.SecurityContextFilter in project tesb-rt-se by Talend.

the class RestaurantReserveApplication method getSingletons.

@Override
public Set<Object> getSingletons() {
    Set<Object> classes = new HashSet<Object>();
    RestaurantReservationService reserveService = new RestaurantReservationService();
    WebClient socialService = WebClient.create("http://localhost:8080/thirdPartyAccess/calendar");
    reserveService.setSocialService(socialService);
    OAuthClientManager manager = new OAuthClientManager();
    manager.setAuthorizationURI("http://localhost:8080/social/authorize");
    WebClient ats = WebClient.create("http://localhost:8080/oauth/token");
    ats.accept(MediaType.APPLICATION_FORM_URLENCODED_TYPE);
    WebClient.getConfig(ats).getHttpConduit().getClient().setReceiveTimeout(1000000L);
    manager.setAccessTokenService(ats);
    reserveService.setOAuthClientManager(manager);
    SecurityContextFilter filter = new SecurityContextFilter();
    filter.setUsers(Collections.singletonMap("barry@restaurant.com", "5678"));
    WebClient restaurantService = WebClient.create("http://localhost:8080/restaurant/reception");
    restaurantService.accept(MediaType.TEXT_PLAIN_TYPE).type(MediaType.APPLICATION_FORM_URLENCODED_TYPE);
    reserveService.setRestaurantService(restaurantService);
    classes.add(reserveService);
    classes.add(filter);
    return classes;
}
Also used : OAuthClientManager(oauth2.thirdparty.OAuthClientManager) SecurityContextFilter(oauth2.thirdparty.SecurityContextFilter) RestaurantReservationService(oauth2.thirdparty.RestaurantReservationService) WebClient(org.apache.cxf.jaxrs.client.WebClient) HashSet(java.util.HashSet)

Example 2 with SecurityContextFilter

use of oauth2.thirdparty.SecurityContextFilter in project tesb-rt-se by Talend.

the class SocialApplication method getSingletons.

@Override
public Set<Object> getSingletons() {
    Set<Object> classes = new HashSet<Object>();
    SocialService socialService = new SocialService();
    socialService.setAccounts(accounts);
    UserRegistrationService userRegService = new UserRegistrationService();
    userRegService.setAccounts(accounts);
    SecurityContextFilter scFilter = new SecurityContextFilter();
    scFilter.setAccounts(accounts);
    ThirdPartyAccessService thirdPartyAccessService = new ThirdPartyAccessService();
    thirdPartyAccessService.setAccounts(accounts);
    AuthorizationCodeGrantService authService = new AuthorizationCodeGrantService();
    authService.setDataProvider(manager);
    classes.add(socialService);
    classes.add(userRegService);
    classes.add(scFilter);
    classes.add(authService);
    classes.add(thirdPartyAccessService);
    return classes;
}
Also used : ThirdPartyAccessService(oauth2.manager.ThirdPartyAccessService) SecurityContextFilter(oauth2.service.SecurityContextFilter) SocialService(oauth2.service.SocialService) UserRegistrationService(oauth2.service.UserRegistrationService) AuthorizationCodeGrantService(org.apache.cxf.rs.security.oauth2.services.AuthorizationCodeGrantService) HashSet(java.util.HashSet)

Aggregations

HashSet (java.util.HashSet)2 ThirdPartyAccessService (oauth2.manager.ThirdPartyAccessService)1 SecurityContextFilter (oauth2.service.SecurityContextFilter)1 SocialService (oauth2.service.SocialService)1 UserRegistrationService (oauth2.service.UserRegistrationService)1 OAuthClientManager (oauth2.thirdparty.OAuthClientManager)1 RestaurantReservationService (oauth2.thirdparty.RestaurantReservationService)1 SecurityContextFilter (oauth2.thirdparty.SecurityContextFilter)1 WebClient (org.apache.cxf.jaxrs.client.WebClient)1 AuthorizationCodeGrantService (org.apache.cxf.rs.security.oauth2.services.AuthorizationCodeGrantService)1