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

Java SAMLDiscovery类代码示例

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

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



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

示例1: idpSelection

import org.springframework.security.saml.SAMLDiscovery; //导入依赖的package包/类
@RequestMapping(value = "/idpSelection", method = RequestMethod.GET)
public ModelAndView idpSelection(HttpServletRequest request, @CurrentUser ApplicationUser currentUser) {
    if (!inLoginProcess(request, currentUser)) {
        return new ModelAndView(NOT_IN_LOGIN_PROCESS_VIEW_NAME);
    }

    Map<String, Object> modelMap = new HashMap<>();
    modelMap.put("idps", getIDPs());
    modelMap.put("idpDiscoReturnURL", request.getAttribute(SAMLDiscovery.RETURN_URL));
    modelMap.put("idpDiscoReturnParam", request.getAttribute(SAMLDiscovery.RETURN_PARAM));
    return new ModelAndView("idpselection", modelMap);
}
 
开发者ID:chrludwig,项目名称:websec-saml2sp,代码行数:13,代码来源:Saml2SPSSOController.java


示例2: configure

import org.springframework.security.saml.SAMLDiscovery; //导入依赖的package包/类
@Override
public void configure(ServiceProviderBuilder builder) throws Exception {
    if (successHandler == null) {
        SavedRequestAwareAuthenticationSuccessHandler successRedirectHandler = createDefaultSuccessHandler();
        successRedirectHandler.setDefaultTargetUrl(Optional.ofNullable(defaultSuccessURL).orElseGet(config::getDefaultSuccessUrl));
        successHandler = postProcess(successRedirectHandler);
    }

    defaultFailureURL = Optional.ofNullable(defaultFailureURL).orElseGet(config::getDefaultFailureUrl);
    if (failureHandler == null) {
        SimpleUrlAuthenticationFailureHandler authenticationFailureHandler = createDefaultFailureHandler();
        authenticationFailureHandler.setDefaultFailureUrl(defaultFailureURL);
        failureHandler = postProcess(authenticationFailureHandler);
    }
    endpoints.setDefaultFailureURL(defaultFailureURL);


    SAMLProcessingFilter ssoFilter = createDefaultSamlProcessingFilter();
    ssoFilter.setAuthenticationManager(authenticationManager);
    ssoFilter.setAuthenticationSuccessHandler(successHandler);
    ssoFilter.setAuthenticationFailureHandler(failureHandler);
    ssoProcessingURL = Optional.ofNullable(ssoProcessingURL).orElseGet(config::getSsoProcessingUrl);
    endpoints.setSsoProcessingURL(ssoProcessingURL);
    ssoFilter.setFilterProcessesUrl(ssoProcessingURL);

    SAMLWebSSOHoKProcessingFilter ssoHoKFilter = null;
    if (Optional.ofNullable(enableSsoHoK).orElseGet(config::isEnableSsoHok)) {
        ssoHoKFilter = createDefaultSamlHoKProcessingFilter();
        ssoHoKFilter.setAuthenticationSuccessHandler(successHandler);
        ssoHoKFilter.setAuthenticationManager(authenticationManager);
        ssoHoKFilter.setAuthenticationFailureHandler(failureHandler);
        ssoHoKProcessingURL = Optional.ofNullable(ssoHoKProcessingURL).orElseGet(config::getSsoHokProcessingUrl);
        endpoints.setSsoHoKProcessingURL(ssoHoKProcessingURL);
        ssoHoKFilter.setFilterProcessesUrl(ssoHoKProcessingURL);
    }

    SAMLDiscovery discoveryFilter = createDefaultSamlDiscoveryFilter();
    discoveryProcessingURL = Optional.ofNullable(discoveryProcessingURL).orElseGet(config::getDiscoveryProcessingUrl);
    endpoints.setDiscoveryProcessingURL(discoveryProcessingURL);
    discoveryFilter.setFilterProcessesUrl(discoveryProcessingURL);
    idpSelectionPageURL = Optional.ofNullable(idpSelectionPageURL).orElseGet(config::getIdpSelectionPageUrl);
    endpoints.setIdpSelectionPageURL(idpSelectionPageURL);
    discoveryFilter.setIdpSelectionPath(idpSelectionPageURL);

    SAMLEntryPoint entryPoint = Optional.ofNullable(samlEntryPointBean).orElseGet(this::createDefaultSamlEntryPoint);
    entryPoint.setDefaultProfileOptions(Optional.ofNullable(profileOptions).orElseGet(this::getProfileOptions));
    ssoLoginURL = Optional.ofNullable(ssoLoginURL).orElseGet(config::getSsoLoginUrl);
    endpoints.setSsoLoginURL(ssoLoginURL);
    entryPoint.setFilterProcessesUrl(ssoLoginURL);

    builder.setSharedObject(SAMLProcessingFilter.class, ssoFilter);
    builder.setSharedObject(SAMLWebSSOHoKProcessingFilter.class, ssoHoKFilter);
    builder.setSharedObject(SAMLDiscovery.class, discoveryFilter);
    builder.setSharedObject(SAMLEntryPoint.class, entryPoint);
}
 
开发者ID:ulisesbocchio,项目名称:spring-boot-security-saml,代码行数:56,代码来源:SSOConfigurer.java


示例3: createDefaultSamlDiscoveryFilter

import org.springframework.security.saml.SAMLDiscovery; //导入依赖的package包/类
@VisibleForTesting
protected SAMLDiscovery createDefaultSamlDiscoveryFilter() {
    return new SAMLDiscovery();
}
 
开发者ID:ulisesbocchio,项目名称:spring-boot-security-saml,代码行数:5,代码来源:SSOConfigurer.java


示例4: configure_defaults

import org.springframework.security.saml.SAMLDiscovery; //导入依赖的package包/类
@Test
public void configure_defaults() throws Exception {
    SSOConfigurer configurer = spy(new SSOConfigurer());
    SAMLProcessingFilter ssoFilter = mock(SAMLProcessingFilter.class);
    when(configurer.createDefaultSamlProcessingFilter()).thenReturn(ssoFilter);
    SAMLWebSSOHoKProcessingFilter ssoHoKFilter = mock(SAMLWebSSOHoKProcessingFilter.class);
    when(configurer.createDefaultSamlHoKProcessingFilter()).thenReturn(ssoHoKFilter);
    SAMLDiscovery discoveryFilter = mock(SAMLDiscovery.class);
    when(configurer.createDefaultSamlDiscoveryFilter()).thenReturn(discoveryFilter);
    SAMLEntryPoint entryPoint = mock(SAMLEntryPoint.class);
    when(configurer.createDefaultSamlEntryPoint()).thenReturn(entryPoint);
    SavedRequestAwareAuthenticationSuccessHandler successHandler = mock(SavedRequestAwareAuthenticationSuccessHandler.class);
    when(configurer.createDefaultSuccessHandler()).thenReturn(successHandler);
    SimpleUrlAuthenticationFailureHandler failureHandler = mock(SimpleUrlAuthenticationFailureHandler.class);
    when(configurer.createDefaultFailureHandler()).thenReturn(failureHandler);
    configurer.init(builder);
    configurer.configure(builder);

    verify(properties).getDefaultFailureUrl();
    verify(properties).getDefaultSuccessUrl();
    verify(properties).getDiscoveryProcessingUrl();
    verify(properties).getIdpSelectionPageUrl();
    verify(properties).getSsoHokProcessingUrl();
    verify(properties).getSsoLoginUrl();
    verify(properties).getSsoProcessingUrl();
    verify(properties).getProfileOptions();

    verify(successHandler).setDefaultTargetUrl(eq(properties.getDefaultSuccessUrl()));
    verify(failureHandler).setDefaultFailureUrl(eq(properties.getDefaultFailureUrl()));

    verify(ssoFilter).setAuthenticationManager(eq(authenticationManager));
    verify(ssoFilter).setAuthenticationSuccessHandler(eq(successHandler));
    verify(ssoFilter).setAuthenticationFailureHandler(eq(failureHandler));
    verify(ssoFilter).setFilterProcessesUrl(eq(properties.getSsoProcessingUrl()));

    verify(ssoHoKFilter).setAuthenticationManager(eq(authenticationManager));
    verify(ssoHoKFilter).setAuthenticationSuccessHandler(eq(successHandler));
    verify(ssoHoKFilter).setAuthenticationFailureHandler(eq(failureHandler));
    verify(ssoHoKFilter).setFilterProcessesUrl(eq(properties.getSsoHokProcessingUrl()));

    verify(serviceProviderEndpoints).setSsoProcessingURL(properties.getSsoProcessingUrl());
    verify(serviceProviderEndpoints).setSsoHoKProcessingURL(properties.getSsoHokProcessingUrl());
    verify(serviceProviderEndpoints).setDefaultFailureURL(properties.getDefaultFailureUrl());
    verify(serviceProviderEndpoints).setDiscoveryProcessingURL(properties.getDiscoveryProcessingUrl());
    verify(serviceProviderEndpoints).setIdpSelectionPageURL(properties.getIdpSelectionPageUrl());
    verify(serviceProviderEndpoints).setSsoLoginURL(properties.getSsoLoginUrl());

    verify(discoveryFilter).setFilterProcessesUrl(eq(properties.getDiscoveryProcessingUrl()));
    verify(discoveryFilter).setIdpSelectionPath(eq(properties.getIdpSelectionPageUrl()));

    verify(entryPoint).setFilterProcessesUrl(eq(properties.getSsoLoginUrl()));
    ArgumentCaptor<WebSSOProfileOptions> optionsCaptor = ArgumentCaptor.forClass(WebSSOProfileOptions.class);
    verify(entryPoint).setDefaultProfileOptions(optionsCaptor.capture());
    WebSSOProfileOptions options = optionsCaptor.getValue();
    Assertions.assertThat(options.isAllowCreate()).isEqualTo(properties.getProfileOptions().getAllowCreate());
    Assertions.assertThat(options.getAllowedIDPs()).isEqualTo(properties.getProfileOptions().getAllowedIdps());
    Assertions.assertThat(options.getAssertionConsumerIndex()).isEqualTo(properties.getProfileOptions().getAssertionConsumerIndex());
    Assertions.assertThat(options.getAuthnContextComparison()).isEqualTo(properties.getProfileOptions().getAuthnContextComparison());
    Assertions.assertThat(options.getAuthnContexts()).isEqualTo(properties.getProfileOptions().getAuthnContexts());
    Assertions.assertThat(options.getBinding()).isEqualTo(properties.getProfileOptions().getBinding());
    Assertions.assertThat(options.getForceAuthN()).isEqualTo(properties.getProfileOptions().getForceAuthn());
    Assertions.assertThat(options.isIncludeScoping()).isEqualTo(properties.getProfileOptions().getIncludeScoping());
    Assertions.assertThat(options.getNameID()).isEqualTo(properties.getProfileOptions().getNameId());
    Assertions.assertThat(options.getPassive()).isEqualTo(properties.getProfileOptions().getPassive());
    Assertions.assertThat(options.getProviderName()).isEqualTo(properties.getProfileOptions().getProviderName());
    Assertions.assertThat(options.getProxyCount()).isEqualTo(properties.getProfileOptions().getProxyCount());
    Assertions.assertThat(options.getRelayState()).isEqualTo(properties.getProfileOptions().getRelayState());

    verify(builder).setSharedObject(eq(SAMLProcessingFilter.class), eq(ssoFilter));
    verify(builder).setSharedObject(eq(SAMLWebSSOHoKProcessingFilter.class), eq(ssoHoKFilter));
    verify(builder).setSharedObject(eq(SAMLDiscovery.class), eq(discoveryFilter));
    verify(builder).setSharedObject(eq(SAMLEntryPoint.class), eq(entryPoint));

}
 
开发者ID:ulisesbocchio,项目名称:spring-boot-security-saml,代码行数:75,代码来源:SSOConfigurerTest.java


示例5: configure_custom_noHoK

import org.springframework.security.saml.SAMLDiscovery; //导入依赖的package包/类
@Test
public void configure_custom_noHoK() throws Exception {
    SSOConfigurer configurer = spy(new SSOConfigurer());
    SAMLProcessingFilter ssoFilter = mock(SAMLProcessingFilter.class);
    when(configurer.createDefaultSamlProcessingFilter()).thenReturn(ssoFilter);
    SAMLWebSSOHoKProcessingFilter ssoHoKFilter = mock(SAMLWebSSOHoKProcessingFilter.class);
    when(configurer.createDefaultSamlHoKProcessingFilter()).thenReturn(ssoHoKFilter);
    SAMLDiscovery discoveryFilter = mock(SAMLDiscovery.class);
    when(configurer.createDefaultSamlDiscoveryFilter()).thenReturn(discoveryFilter);
    SAMLEntryPoint entryPoint = mock(SAMLEntryPoint.class);
    when(configurer.createDefaultSamlEntryPoint()).thenReturn(entryPoint);
    SavedRequestAwareAuthenticationSuccessHandler successHandler = mock(SavedRequestAwareAuthenticationSuccessHandler.class);
    SimpleUrlAuthenticationFailureHandler failureHandler = mock(SimpleUrlAuthenticationFailureHandler.class);
    WebSSOProfileOptions profileOptions = mock(WebSSOProfileOptions.class);

    configurer.init(builder);
    configurer
            .defaultSuccessURL("/success")
            .failureHandler(failureHandler)
            .successHandler(successHandler)
            .defaultFailureURL("/failure")
            .discoveryProcessingURL("/discovery")
            .enableSsoHoK(false)
            .idpSelectionPageURL("/idp")
            .profileOptions(profileOptions)
            .ssoHoKProcessingURL("/hok")
            .ssoLoginURL("/login")
            .ssoProcessingURL("/sso");
    configurer.configure(builder);

    verify(properties, never()).getDefaultFailureUrl();
    verify(properties, never()).getDefaultSuccessUrl();
    verify(properties, never()).getDiscoveryProcessingUrl();
    verify(properties, never()).getIdpSelectionPageUrl();
    verify(properties, never()).getSsoHokProcessingUrl();
    verify(properties, never()).getSsoLoginUrl();
    verify(properties, never()).getSsoProcessingUrl();
    verify(properties, never()).getProfileOptions();

    verify(successHandler, never()).setDefaultTargetUrl(eq("/success"));
    verify(failureHandler, never()).setDefaultFailureUrl(eq("/failure"));

    verify(ssoFilter).setAuthenticationManager(eq(authenticationManager));
    verify(ssoFilter).setAuthenticationSuccessHandler(eq(successHandler));
    verify(ssoFilter).setAuthenticationFailureHandler(eq(failureHandler));
    verify(ssoFilter).setFilterProcessesUrl(eq("/sso"));

    verify(ssoHoKFilter, never()).setAuthenticationManager(eq(authenticationManager));
    verify(ssoHoKFilter, never()).setAuthenticationSuccessHandler(eq(successHandler));
    verify(ssoHoKFilter, never()).setAuthenticationFailureHandler(eq(failureHandler));
    verify(ssoHoKFilter, never()).setFilterProcessesUrl(eq("/hok"));

    verify(serviceProviderEndpoints).setSsoProcessingURL("/sso");
    verify(serviceProviderEndpoints, never()).setSsoHoKProcessingURL("/hok");
    verify(serviceProviderEndpoints).setDefaultFailureURL("/failure");
    verify(serviceProviderEndpoints).setDiscoveryProcessingURL("/discovery");
    verify(serviceProviderEndpoints).setIdpSelectionPageURL("/idp");
    verify(serviceProviderEndpoints).setSsoLoginURL("/login");

    verify(discoveryFilter).setFilterProcessesUrl(eq("/discovery"));
    verify(discoveryFilter).setIdpSelectionPath(eq("/idp"));

    verify(entryPoint).setFilterProcessesUrl(eq("/login"));
    verify(entryPoint).setDefaultProfileOptions(eq(profileOptions));

    verify(builder).setSharedObject(eq(SAMLProcessingFilter.class), eq(ssoFilter));
    verify(builder).setSharedObject(eq(SAMLWebSSOHoKProcessingFilter.class), eq(null));
    verify(builder).setSharedObject(eq(SAMLDiscovery.class), eq(discoveryFilter));
    verify(builder).setSharedObject(eq(SAMLEntryPoint.class), eq(entryPoint));

}
 
开发者ID:ulisesbocchio,项目名称:spring-boot-security-saml,代码行数:72,代码来源:SSOConfigurerTest.java


示例6: samlIDPDiscovery

import org.springframework.security.saml.SAMLDiscovery; //导入依赖的package包/类
@Bean
public SAMLDiscovery samlIDPDiscovery() {
    return new SAMLDiscovery();
}
 
开发者ID:choonchernlim,项目名称:spring-security-adfs-saml2,代码行数:5,代码来源:SAMLWebSecurityConfigurerAdapter.java


示例7: comesFromDiscoveryFilter

import org.springframework.security.saml.SAMLDiscovery; //导入依赖的package包/类
private boolean comesFromDiscoveryFilter(HttpServletRequest request) {
    return request.getAttribute(SAMLConstants.LOCAL_ENTITY_ID) != null &&
            request.getAttribute(SAMLDiscovery.RETURN_URL) != null &&
            request.getAttribute(SAMLDiscovery.RETURN_PARAM) != null;
}
 
开发者ID:ulisesbocchio,项目名称:spring-boot-security-saml-samples,代码行数:6,代码来源:IdPSelectionController.java


示例8: samlIDPDiscovery

import org.springframework.security.saml.SAMLDiscovery; //导入依赖的package包/类
@Bean
public SAMLDiscovery samlIDPDiscovery() {
    SAMLDiscovery idpDiscovery = new SAMLDiscovery();
    idpDiscovery.setIdpSelectionPath("/saml/idpSelection");
    return idpDiscovery;
}
 
开发者ID:vdenotaris,项目名称:spring-boot-security-saml-sample,代码行数:7,代码来源:WebSecurityConfig.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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