use of org.springframework.security.context.SecurityContextImpl in project gocd by gocd.
the class GoConfigAdministrationControllerIntegrationTest method setCurrentUser.
private void setCurrentUser(String username) {
SecurityContextImpl context = new SecurityContextImpl();
context.setAuthentication(new UsernamePasswordAuthenticationToken(new User(username, "", true, new GrantedAuthority[] {}), null));
SecurityContextHolder.setContext(context);
}
use of org.springframework.security.context.SecurityContextImpl in project gocd by gocd.
the class SecurityContextHelper method setCurrentUserWithAuthorities.
public static void setCurrentUserWithAuthorities(String username, final GrantedAuthority[] authorities) {
SecurityContextImpl context = new SecurityContextImpl();
context.setAuthentication(new UsernamePasswordAuthenticationToken(new User(username, "", true, authorities), null, authorities));
SecurityContextHolder.setContext(context);
}
use of org.springframework.security.context.SecurityContextImpl in project gocd by gocd.
the class GoVelocityViewTest method setUp.
@Before
public void setUp() throws Exception {
initMocks(this);
when(featureToggleService.isToggleOn(anyString())).thenReturn(true);
Toggles.initializeWith(featureToggleService);
view = spy(new GoVelocityView());
doReturn(railsAssetsService).when(view).getRailsAssetsService();
doReturn(versionInfoService).when(view).getVersionInfoService();
request = new MockHttpServletRequest();
velocityContext = new VelocityContext();
securityContext = new SecurityContextImpl();
}
Aggregations