protected final MetaDataLocator neverWhitelistProtected() { MetaDataLocator l = mockMetaDataLocator(); expect( l.findMeta( EasyMock.anyObject(String.class), EasyMock.anyObject(String.class), EasyMock.eq(boolean.class))) .andReturn(false); return l; }
public static String checkForComponentEvent( String pageName, String componentId, String eventId, String eventType, ApplicationStateManager applicationStateManager, ComponentSource componentSource, MetaDataLocator locator) { String redirectPage = null; String authenticationPolicyMeta = EVENT_HANDLER_AUTHENTICATION_TYPE + "-" + eventId + "-" + eventType; authenticationPolicyMeta = authenticationPolicyMeta.toLowerCase(); Component component = null; if (componentId == null) { component = componentSource.getPage(pageName); } else { component = componentSource.getComponent(pageName + ":" + componentId); } try { String policyAsString = locator.findMeta( authenticationPolicyMeta, component.getComponentResources(), String.class); AuthenticationPolicyType policy = AuthenticationPolicyType.valueOf(policyAsString); redirectPage = AuthenticationValidator.check(policy, applicationStateManager); } catch (RuntimeException e) { System.err.println(e.getMessage()); } return redirectPage; }
public static String checkForPage( String pageName, ApplicationStateManager applicationStateManager, ComponentSource componentSource, MetaDataLocator locator) { String redirectPage = null; Component page = componentSource.getPage(pageName); try { String policyAsString = locator.findMeta(PAGE_AUTHENTICATION_TYPE, page.getComponentResources(), String.class); AuthenticationPolicyType policy = AuthenticationPolicyType.valueOf(policyAsString); redirectPage = check(policy, applicationStateManager); } catch (RuntimeException e) { System.err.println(e.getMessage()); } return redirectPage; }