use of org.springframework.security.core.context.SecurityContext in project head by mifos.
the class RepayLoanActionStrutsTest method setMifosUserFromContext.
private void setMifosUserFromContext() {
SecurityContext securityContext = new SecurityContextImpl();
MifosUser principal = new MifosUser(userContext.getId(), userContext.getBranchId(), userContext.getLevelId(), new ArrayList<Short>(userContext.getRoles()), userContext.getName(), "".getBytes(), true, true, true, true, new ArrayList<GrantedAuthority>(), userContext.getLocaleId());
Authentication authentication = new TestingAuthenticationToken(principal, principal);
securityContext.setAuthentication(authentication);
SecurityContextHolder.setContext(securityContext);
}
use of org.springframework.security.core.context.SecurityContext in project head by mifos.
the class ApplyAdjustmentActionStrutsTest method setUpSecurityContext.
private void setUpSecurityContext() {
SecurityContext securityContext = new SecurityContextImpl();
MifosUser mifosUser = new MifosUserBuilder().nonLoanOfficer().withAdminRole().build();
Authentication authentication = new TestingAuthenticationToken(mifosUser, mifosUser);
securityContext.setAuthentication(authentication);
SecurityContextHolder.setContext(securityContext);
}
use of org.springframework.security.core.context.SecurityContext in project head by mifos.
the class ApplyChargeActionStrutsTest method testUpdateSuccess.
@Test
public void testUpdateSuccess() {
SecurityContext securityContext = new SecurityContextImpl();
MifosUser principal = new MifosUserBuilder().nonLoanOfficer().withAdminRole().build();
Authentication authentication = new TestingAuthenticationToken(principal, principal);
securityContext.setAuthentication(authentication);
SecurityContextHolder.setContext(securityContext);
request.setAttribute(Constants.CURRENTFLOWKEY, flowKey);
createInitialObjects();
accountBO = getLoanAccount(client, meeting);
setRequestPathInfo("/applyChargeAction.do");
addRequestParameter("method", "update");
addRequestParameter("chargeType", IS_PENALTY_TYPE + ":" + FEE_ID + ":" + IS_NOT_RATE_TYPE);
addRequestParameter("charge", "18");
addRequestParameter("accountId", accountBO.getAccountId().toString());
addRequestParameter(Constants.CURRENTFLOWKEY, (String) request.getAttribute(Constants.CURRENTFLOWKEY));
actionPerform();
// verifyForward("loanDetails_success");
verifyNoActionErrors();
verifyNoActionMessages();
}
use of org.springframework.security.core.context.SecurityContext in project head by mifos.
the class SavingsClosureActionStrutsTest method tearDown.
@After
public void tearDown() throws Exception {
SecurityContext securityContext = new SecurityContextImpl();
SecurityContextHolder.setContext(securityContext);
savings = null;
client1 = null;
client2 = null;
client3 = null;
client4 = null;
group = null;
center = null;
}
use of org.springframework.security.core.context.SecurityContext in project head by mifos.
the class SavingsDepositWithdrawalActionStrutsTest method setUp.
@Before
public void setUp() throws Exception {
userContext = TestObjectFactory.getContext();
userContext.setPreferredLocale(new Locale("en", "GB"));
addRequestParameter("recordLoanOfficerId", "1");
addRequestParameter("recordOfficeId", "1");
request.getSession().setAttribute(Constants.USER_CONTEXT_KEY, userContext);
request.getSession(false).setAttribute("ActivityContext", TestObjectFactory.getActivityContext());
flowKey = createFlow(request, SavingsDepositWithdrawalAction.class);
request.setAttribute(Constants.CURRENTFLOWKEY, flowKey);
addRequestParameter(Constants.CURRENTFLOWKEY, flowKey);
SecurityContext securityContext = new SecurityContextImpl();
MifosUser principal = new MifosUserBuilder().build();
Authentication authentication = new TestingAuthenticationToken(principal, principal);
securityContext.setAuthentication(authentication);
SecurityContextHolder.setContext(securityContext);
}
Aggregations