• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Event类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.springframework.webflow.execution.Event的典型用法代码示例。如果您正苦于以下问题:Java Event类的具体用法?Java Event怎么用?Java Event使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Event类属于org.springframework.webflow.execution包,在下文中一共展示了Event类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: loginUnsuccessfully

import org.springframework.webflow.execution.Event; //导入依赖的package包/类
@Override
protected MockHttpServletResponse loginUnsuccessfully(final String username, final String fromAddress) throws Exception {
    final MockHttpServletRequest request = new MockHttpServletRequest();
    final MockHttpServletResponse response = new MockHttpServletResponse();
    request.setMethod("POST");
    request.setParameter("username", username);
    request.setRemoteAddr(fromAddress);
    final MockRequestContext context = new MockRequestContext();
    context.setCurrentEvent(new Event(StringUtils.EMPTY, "error"));
    request.setAttribute("flowRequestContext", context);
    ClientInfoHolder.setClientInfo(new ClientInfo(request));
    response.setStatus(HttpServletResponse.SC_UNAUTHORIZED);

    throttle.preHandle(request, response, null);

    try {
        authenticationManager.authenticate(AuthenticationTransaction.wrap(CoreAuthenticationTestUtils.getService(), badCredentials(username)));
    } catch (final AuthenticationException e) {
        throttle.postHandle(request, response, null, null);
        return response;
    }
    fail("Expected AbstractAuthenticationException");
    return null;
}
 
开发者ID:mrluo735,项目名称:cas-5.1.0,代码行数:25,代码来源:InspektrThrottledSubmissionByIpAddressAndUsernameHandlerInterceptorAdapterTests.java


示例2: ensureRemoteIpShouldBeChecked

import org.springframework.webflow.execution.Event; //导入依赖的package包/类
@Test
public void ensureRemoteIpShouldBeChecked() {
    final BaseSpnegoKnownClientSystemsFilterAction action =
            new BaseSpnegoKnownClientSystemsFilterAction("^192\\.158\\..+", "", 0);

    final MockRequestContext ctx = new MockRequestContext();
    final MockHttpServletRequest req = new MockHttpServletRequest();
    req.setRemoteAddr("192.158.5.781");
    final ServletExternalContext extCtx = new ServletExternalContext(
            new MockServletContext(), req,
            new MockHttpServletResponse());
    ctx.setExternalContext(extCtx);

    final Event ev = action.doExecute(ctx);
    assertEquals(ev.getId(), new EventFactorySupport().yes(this).getId());
}
 
开发者ID:mrluo735,项目名称:cas-5.1.0,代码行数:17,代码来源:AllSpnegoKnownClientSystemsFilterActionTests.java


示例3: terminate

import org.springframework.webflow.execution.Event; //导入依赖的package包/类
/**
 * Terminates the CAS SSO session by destroying the TGT (if any) and removing cookies related to the SSO session.
 *
 * @param context Request context.
 *
 * @return "success"
 */
public Event terminate(final RequestContext context) {
    // in login's webflow : we can get the value from context as it has already been stored
    String tgtId = WebUtils.getTicketGrantingTicketId(context);
    // for logout, we need to get the cookie's value
    if (tgtId == null) {
        final HttpServletRequest request = WebUtils.getHttpServletRequest(context);
        tgtId = this.ticketGrantingTicketCookieGenerator.retrieveCookieValue(request);
    }
    if (tgtId != null) {
        WebUtils.putLogoutRequests(context, this.centralAuthenticationService.destroyTicketGrantingTicket(tgtId));
    }
    final HttpServletResponse response = WebUtils.getHttpServletResponse(context);
    this.ticketGrantingTicketCookieGenerator.removeCookie(response);
    this.warnCookieGenerator.removeCookie(response);
    return this.eventFactorySupport.success(this);
}
 
开发者ID:luotuo,项目名称:cas4.0.x-server-wechat,代码行数:24,代码来源:TerminateSessionAction.java


示例4: testOIDCAuthnRequestNoFlags

import org.springframework.webflow.execution.Event; //导入依赖的package包/类
/**
 * Test that the action functions properly if the inbound message is a oidc
 * authentication request.
 */
@Test
public void testOIDCAuthnRequestNoFlags() throws Exception {
    AuthenticationRequest req = AuthenticationRequest
            .parse("response_type=code&client_id=s6BhdRkqt3&login_hint=foo&redirect_uri=https%3A%2F%2Fclient.example.org%2Fcb&scope=openid%20profile&state=af0ifjsldkj&nonce=n-0S6_WzA2Mj");
    final RequestContext requestCtx = new RequestContextBuilder().setInboundMessage(req).buildRequestContext();
    @SuppressWarnings("rawtypes")
    final ProfileRequestContext prc = new WebflowRequestContextProfileRequestContextLookup().apply(requestCtx);
    final InitializeAuthenticationContext action = new InitializeAuthenticationContext();
    action.initialize();
    final Event event = action.execute(requestCtx);
    ActionTestingSupport.assertProceedEvent(event);
    AuthenticationContext authnCtx = prc.getSubcontext(AuthenticationContext.class);
    Assert.assertFalse(authnCtx.isForceAuthn());
    Assert.assertFalse(authnCtx.isPassive());
    Assert.assertEquals(authnCtx.getHintedName(), "foo");

}
 
开发者ID:CSCfi,项目名称:shibboleth-idp-oidc-extension,代码行数:22,代码来源:InitializeAuthenticationContextTest.java


示例5: ensureHostnameAndIpShouldDoSpnego

import org.springframework.webflow.execution.Event; //导入依赖的package包/类
@Test
public void ensureHostnameAndIpShouldDoSpnego() {
    final HostNameSpnegoKnownClientSystemsFilterAction action =
            new HostNameSpnegoKnownClientSystemsFilterAction("\\w+\\.\\w+\\.\\w+");
    action.setIpsToCheckPattern("74\\..+");

    final MockRequestContext ctx = new MockRequestContext();
    final MockHttpServletRequest req = new MockHttpServletRequest();
    req.setRemoteAddr("74.125.136.102");
    final ServletExternalContext extCtx = new ServletExternalContext(
            new MockServletContext(), req,
            new MockHttpServletResponse());
    ctx.setExternalContext(extCtx);

    final Event ev = action.doExecute(ctx);
    assertEquals(ev.getId(), new EventFactorySupport().yes(this).getId());

}
 
开发者ID:yuweijun,项目名称:cas-server-4.2.1,代码行数:19,代码来源:AllSpnegoKnownClientSystemsFilterActionTest.java


示例6: testRequestPickActive

import org.springframework.webflow.execution.Event; //导入依赖的package包/类
@Test
public void testRequestPickActive() {
    final AuthenticationContext authCtx = prc.getSubcontext(AuthenticationContext.class);
    final List<Principal> principals = Arrays.<Principal> asList(new TestPrincipal("test3"), new TestPrincipal(
            "test2"));
    final RequestedPrincipalContext rpc = new RequestedPrincipalContext();
    rpc.getPrincipalEvalPredicateFactoryRegistry().register(TestPrincipal.class, "exact",
            new ExactPrincipalEvalPredicateFactory());
    rpc.setOperator("exact");
    rpc.setRequestedPrincipals(principals);
    authCtx.addSubcontext(rpc, true);
    final AuthenticationResult active = new AuthenticationResult("test3", new Subject());
    active.getSubject().getPrincipals().add(new TestPrincipal("test3"));
    authCtx.setActiveResults(Arrays.asList(active));
    authCtx.getPotentialFlows().get("test3").setSupportedPrincipals(ImmutableList.of(principals.get(0)));

    final Event event = action.execute(src);

    ActionTestingSupport.assertProceedEvent(event);
    Assert.assertEquals(active, authCtx.getAuthenticationResult());
}
 
开发者ID:CSCfi,项目名称:shibboleth-idp-oidc-extension,代码行数:22,代码来源:SelectAuthenticationFlowTest.java


示例7: loginUnsuccessfully

import org.springframework.webflow.execution.Event; //导入依赖的package包/类
@Override
protected MockHttpServletResponse loginUnsuccessfully(final String username, final String fromAddress)
        throws Exception {
    final MockHttpServletRequest request = new MockHttpServletRequest();
    final MockHttpServletResponse response = new MockHttpServletResponse();
    request.setMethod("POST");
    request.setParameter("username", username);
    request.setRemoteAddr(fromAddress);
    final MockRequestContext context = new MockRequestContext();
    context.setCurrentEvent(new Event("", "error"));
    request.setAttribute("flowRequestContext", context);
    ClientInfoHolder.setClientInfo(new ClientInfo(request));

    getThrottle().preHandle(request, response, null);

    try {
        authenticationManager.authenticate(AuthenticationTransaction.wrap(badCredentials(username)));
    } catch (final AuthenticationException e) {
        getThrottle().postHandle(request, response, null, null);
        return response;
    }
    fail("Expected AbstractAuthenticationException");
    return null;
}
 
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:25,代码来源:InspektrThrottledSubmissionByIpAddressAndUsernameHandlerInterceptorAdapterTests.java


示例8: loginUnsuccessfully

import org.springframework.webflow.execution.Event; //导入依赖的package包/类
@Override
protected MockHttpServletResponse loginUnsuccessfully(final String username, final String fromAddress)
        throws Exception {
    final MockHttpServletRequest request = new MockHttpServletRequest();
    final MockHttpServletResponse response = new MockHttpServletResponse();
    request.setMethod("POST");
    request.setParameter("username", username);
    request.setRemoteAddr(fromAddress);
    final MockRequestContext context = new MockRequestContext();
    context.setCurrentEvent(new Event("", "error"));
    request.setAttribute("flowRequestContext", context);
    ClientInfoHolder.setClientInfo(new ClientInfo(request));

    getThrottle().preHandle(request, response, null);

    try {
        authenticationManager.authenticate(badCredentials(username));
    } catch (final AuthenticationException e) {
        getThrottle().postHandle(request, response, null, null);
        return response;
    }
    fail("Expected AuthenticationException");
    return null;
}
 
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:25,代码来源:InspektrThrottledSubmissionByIpAddressAndUsernameHandlerInterceptorAdapterTests.java


示例9: supportsInternal

import org.springframework.webflow.execution.Event; //导入依赖的package包/类
@Override
protected boolean supportsInternal(final Event e, final Authentication authentication, final RegisteredService registeredService) {
    if (!super.supportsInternal(e, authentication, registeredService)) {
        return false;
    }

    final Principal principal = authentication.getPrincipal();
    final DuoUserAccountAuthStatus acct = this.duoAuthenticationService.getDuoUserAccountAuthStatus(principal.getId());
    LOGGER.debug("Found duo user account status [{}] for [{}]", acct, principal);

    if (acct == DuoUserAccountAuthStatus.ALLOW) {
        LOGGER.debug("Account status is set for allow/bypass for [{}]", principal);
        return false;
    }
    if (acct == DuoUserAccountAuthStatus.DENY) {
        LOGGER.warn("Account status is set to deny access to [{}]", principal);
    }

    return true;
}
 
开发者ID:mrluo735,项目名称:cas-5.1.0,代码行数:21,代码来源:DefaultDuoMultifactorAuthenticationProvider.java


示例10: verifyLogoutOneLogoutRequestNotAttempted

import org.springframework.webflow.execution.Event; //导入依赖的package包/类
@Test
public void verifyLogoutOneLogoutRequestNotAttempted() throws Exception {
    final SingleLogoutService service = new WebApplicationServiceFactory().createService(TEST_URL, SingleLogoutService.class);
    final LogoutRequest logoutRequest = new DefaultLogoutRequest(TICKET_ID,
            service,
            new URL(TEST_URL));
    final Event event = getLogoutEvent(Arrays.asList(logoutRequest));

    assertEquals(FrontChannelLogoutAction.REDIRECT_APP_EVENT, event.getId());
    final List<LogoutRequest> list = WebUtils.getLogoutRequests(this.requestContext);
    assertEquals(1, list.size());
    final String url = (String) event.getAttributes().get(FrontChannelLogoutAction.DEFAULT_FLOW_ATTRIBUTE_LOGOUT_URL);
    assertTrue(url.startsWith(TEST_URL + '?' + FrontChannelLogoutAction.DEFAULT_LOGOUT_PARAMETER + '='));
    final byte[] samlMessage = CompressionUtils.decodeBase64ToByteArray(
            URLDecoder.decode(StringUtils.substringAfter(url, '?' + FrontChannelLogoutAction.DEFAULT_LOGOUT_PARAMETER + '='), "UTF-8"));
    final Inflater decompresser = new Inflater();
    decompresser.setInput(samlMessage);
    final byte[] result = new byte[1000];
    decompresser.inflate(result);
    decompresser.end();
    final String message = new String(result);
    assertTrue(message.startsWith("<samlp:LogoutRequest xmlns:samlp=\"urn:oasis:names:tc:SAML:2.0:protocol\" ID=\""));
    assertTrue(message.contains("<samlp:SessionIndex>" + TICKET_ID + "</samlp:SessionIndex>"));
}
 
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:25,代码来源:FrontChannelLogoutActionTests.java


示例11: verifyLogoutUrlForServiceIsUsed

import org.springframework.webflow.execution.Event; //导入依赖的package包/类
@Test
public void verifyLogoutUrlForServiceIsUsed() throws Exception {
    final RegisteredService svc = getRegisteredService();
    when(this.servicesManager.findServiceBy(any(SingleLogoutService.class))).thenReturn(svc);

    final SingleLogoutService service = mock(SingleLogoutService.class);
    when(service.getId()).thenReturn(svc.getServiceId());
    when(service.getOriginalUrl()).thenReturn(svc.getServiceId());

    final MockTicketGrantingTicket tgt = new MockTicketGrantingTicket("test");
    tgt.getServices().put("service", service);
    final Event event = getLogoutEvent(this.logoutManager.performLogout(tgt));
    assertEquals(FrontChannelLogoutAction.REDIRECT_APP_EVENT, event.getId());
    final List<LogoutRequest> list = WebUtils.getLogoutRequests(this.requestContext);
    assertEquals(1, list.size());
    final String url = (String) event.getAttributes().get(FrontChannelLogoutAction.DEFAULT_FLOW_ATTRIBUTE_LOGOUT_URL);
    assertTrue(url.startsWith(svc.getLogoutUrl().toExternalForm()));

}
 
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:20,代码来源:FrontChannelLogoutActionTests.java


示例12: loginUnsuccessfully

import org.springframework.webflow.execution.Event; //导入依赖的package包/类
@Override
protected MockHttpServletResponse loginUnsuccessfully(final String username, final String fromAddress)
        throws Exception {
    final MockHttpServletRequest request = new MockHttpServletRequest();
    final MockHttpServletResponse response = new MockHttpServletResponse();
    request.setMethod("POST");
    request.setParameter("username", username);
    request.setRemoteAddr(fromAddress);
    MockRequestContext context = new MockRequestContext();
    context.setCurrentEvent(new Event("", "error"));
    request.setAttribute("flowRequestContext", context);
    ClientInfoHolder.setClientInfo(new ClientInfo(request));

    getThrottle().preHandle(request, response, null);

    try {
        authenticationManager.authenticate(badCredentials(username));
    } catch (final AuthenticationException e) {
        getThrottle().postHandle(request, response, null, null);
        return response;
    }
    fail("Expected AuthenticationException");
    return null;
}
 
开发者ID:luotuo,项目名称:cas4.0.x-server-wechat,代码行数:25,代码来源:InspektrThrottledSubmissionByIpAddressAndUsernameHandlerInterceptorAdapterTests.java


示例13: ensureAltRemoteIpHeaderShouldBeChecked

import org.springframework.webflow.execution.Event; //导入依赖的package包/类
@Test
public void ensureAltRemoteIpHeaderShouldBeChecked() {
    final BaseSpnegoKnownClientSystemsFilterAction action =
            new BaseSpnegoKnownClientSystemsFilterAction("^74\\.125\\..+", "alternateRemoteIp");

    final MockRequestContext ctx = new MockRequestContext();
    final MockHttpServletRequest req = new MockHttpServletRequest();
    req.setRemoteAddr("555.555.555.555");
    req.addHeader("alternateRemoteIp", "74.125.136.102");
    final ServletExternalContext extCtx = new ServletExternalContext(
            new MockServletContext(), req,
            new MockHttpServletResponse());
    ctx.setExternalContext(extCtx);

    final Event ev = action.doExecute(ctx);
    assertEquals(ev.getId(), new EventFactorySupport().yes(this).getId());
}
 
开发者ID:yuweijun,项目名称:cas-server-4.2.1,代码行数:18,代码来源:AllSpnegoKnownClientSystemsFilterActionTest.java


示例14: ensureHostnameShouldDoSpnego

import org.springframework.webflow.execution.Event; //导入依赖的package包/类
@Test
public void ensureHostnameShouldDoSpnego() {
    final HostNameSpnegoKnownClientSystemsFilterAction action =
            new HostNameSpnegoKnownClientSystemsFilterAction("\\w+\\.\\w+\\.\\w+");

    final MockRequestContext ctx = new MockRequestContext();
    final MockHttpServletRequest req = new MockHttpServletRequest();
    req.setRemoteAddr("74.125.136.102");
    final ServletExternalContext extCtx = new ServletExternalContext(
            new MockServletContext(), req,
            new MockHttpServletResponse());
    ctx.setExternalContext(extCtx);

    final Event ev = action.doExecute(ctx);
    assertEquals(ev.getId(), new EventFactorySupport().yes(this).getId());

}
 
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:18,代码来源:AllSpnegoKnownClientSystemsFilterActionTest.java


示例15: verifyIpMismatchWhenCheckingHostnameForSpnego

import org.springframework.webflow.execution.Event; //导入依赖的package包/类
@Test
public void verifyIpMismatchWhenCheckingHostnameForSpnego() {
    final HostNameSpnegoKnownClientSystemsFilterAction action =
            new HostNameSpnegoKnownClientSystemsFilterAction("\\w+\\.\\w+\\.\\w+");
    action.setIpsToCheckPattern("14\\..+");

    final MockRequestContext ctx = new MockRequestContext();
    final MockHttpServletRequest req = new MockHttpServletRequest();
    req.setRemoteAddr("74.125.136.102");
    final ServletExternalContext extCtx = new ServletExternalContext(
            new MockServletContext(), req,
            new MockHttpServletResponse());
    ctx.setExternalContext(extCtx);

    final Event ev = action.doExecute(ctx);
    assertEquals(ev.getId(), new EventFactorySupport().no(this).getId());

}
 
开发者ID:yuweijun,项目名称:cas-server-4.2.1,代码行数:19,代码来源:AllSpnegoKnownClientSystemsFilterActionTest.java


示例16: ensureLdapAttributeShouldDoSpnego

import org.springframework.webflow.execution.Event; //导入依赖的package包/类
@Test
public void ensureLdapAttributeShouldDoSpnego() {
    final LdapSpnegoKnownClientSystemsFilterAction action =
            new LdapSpnegoKnownClientSystemsFilterAction(this.connectionFactory, this.searchRequest, "mail") {
                @Override
                protected String getRemoteHostName(final String remoteIp) {
                    if ("localhost".equalsIgnoreCase(remoteIp) || remoteIp.startsWith("127")) {
                        return remoteIp;
                    }
                    return super.getRemoteHostName(remoteIp);
                }
            };
    final MockRequestContext ctx = new MockRequestContext();
    final MockHttpServletRequest req = new MockHttpServletRequest();
    req.setRemoteAddr("localhost");
    final ServletExternalContext extCtx = new ServletExternalContext(
            new MockServletContext(), req,
            new MockHttpServletResponse());
    ctx.setExternalContext(extCtx);

    final Event ev = action.doExecute(ctx);
    assertEquals(ev.getId(), new EventFactorySupport().yes(this).getId());
}
 
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:24,代码来源:LdapSpnegoKnownClientSystemsFilterActionTests.java


示例17: authorizedServiceProvided

import org.springframework.webflow.execution.Event; //导入依赖的package包/类
@Test
public void authorizedServiceProvided() throws Exception {
    final MockRequestContext mockRequestContext = new MockRequestContext();
    mockRequestContext.getFlowScope().put("service", this.authorizedService);
    final Event event = this.serviceAuthorizationCheck.doExecute(mockRequestContext);
    assertEquals("success", event.getId());
}
 
开发者ID:yuweijun,项目名称:cas-server-4.2.1,代码行数:8,代码来源:ServiceAuthorizationCheckTests.java


示例18: testNoCtx

import org.springframework.webflow.execution.Event; //导入依赖的package包/类
/**
 * Test that action copes with no id token in response context.
 * 
 * @throws ComponentInitializationException
 */
@Test
public void testNoCtx() throws ComponentInitializationException {
    init();
    final Event event = action.execute(requestCtx);
    ActionTestingSupport.assertEvent(event, EventIds.INVALID_MSG_CTX);

}
 
开发者ID:CSCfi,项目名称:shibboleth-idp-oidc-extension,代码行数:13,代码来源:AddAcrToIDTokenTest.java


示例19: testSuccess

import org.springframework.webflow.execution.Event; //导入依赖的package包/类
/**
 * Test that action handles case of no acr.
 * 
 * @throws ComponentInitializationException
 * @throws ParseException
 */
@Test
public void testSuccess() throws ComponentInitializationException, ParseException {
    init();
    setIdTokenToResponseContext("iss", "sub", "aud", new Date(), new Date());
    final Event event = action.execute(requestCtx);
    ActionTestingSupport.assertProceedEvent(event);
    Assert.assertNull(respCtx.getIDToken().getACR());
}
 
开发者ID:CSCfi,项目名称:shibboleth-idp-oidc-extension,代码行数:15,代码来源:AddAcrToIDTokenTest.java


示例20: verifyLogoutRequestBack

import org.springframework.webflow.execution.Event; //导入依赖的package包/类
@Test
public void verifyLogoutRequestBack() throws Exception {
    final Cookie cookie = new Cookie(COOKIE_TGC_ID, "test");
    this.request.setCookies(cookie);
    final LogoutRequest logoutRequest = new DefaultLogoutRequest("", null, null);
    logoutRequest.setStatus(LogoutRequestStatus.SUCCESS);
    WebUtils.putLogoutRequests(this.requestContext, Arrays.asList(logoutRequest));
    final Event event = this.logoutAction.doExecute(this.requestContext);
    assertEquals(LogoutAction.FINISH_EVENT, event.getId());
}
 
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:11,代码来源:LogoutActionTests.java



注:本文中的org.springframework.webflow.execution.Event类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Sysout类代码示例发布时间:2022-05-21
下一篇:
Java RegTestParams类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap