标签: saml

使用 SAML 连接 GitLab 帐户

我正在尝试将 SAML 身份验证与 GitLab 结合使用。在 gitlab.rb 中我指定

gitlab_rails['omniauth_enabled'] = true
gitlab_rails['omniauth_allow_single_sign_on'] = false
gitlab_rails['omniauth_block_auto_created_users'] = false
gitlab_rails['omniauth_providers'] = [
    {
      "name" => "saml",
       args: {
assertion_consumer_service_url: 'https://git.mycompany.com/users/auth/saml/callback',
               idp_cert_fingerprint: 'XX:YY:ZZ',
               idp_sso_target_url: 'https://myidentity.com/SAAS/auth/federation/sso',
               issuer: 'https://git.mycompany.com',
               name_identifier_format: 'urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress'
             }
    }
  ]
Run Code Online (Sandbox Code Playgroud)

现在,当我尝试使用 SAML 登录时,出现错误

不允许在没有预先存在的 GitLab 帐户的情况下使用您的 Saml 帐户登录。首先创建一个 GitLab 帐户,然后将其连接到您的 Saml 帐户。

我已经创建了一个名为 user1@mycompany.com 的 Git 用户

我该如何修复这个错误?

ruby git saml gitlab

3
推荐指数
1
解决办法
5018
查看次数

SAML:即使用户有 IDP 会话,是否也可以强制用户完成登录过程

在 SAML 中,是否可以强制用户每次都执行 idp 登录过程,即使用户有活动的 idp 会话?

在这里举一个具体的例子:让我们将我的应用程序称为“SP”,我使用 SSOCirecle 作为 idp,并使用 POST 和重定向(SP 发起)。

为了进行测试,我将首先登录 SSOCircle 以获取活动的 idp 会话。然后当我尝试访问 SP 时,我应该被重定向到 idp。

通常,由于我已经有一个活动的 idp 会话,idp 会看到“哦,您之前已经通过了身份验证,您可以直接转到 SP!”

但我不希望这样,我希望 idp 强制用​​户每次都输入凭据,也许可以通过其中之一(我猜)

  1. 忽略活动的 IDP 会话
  2. 不要创建 IDP 会话

我想知道这是否可行。

saml single-sign-on saml-2.0 spring-saml

3
推荐指数
1
解决办法
5771
查看次数

使用 Django REST 框架进行 SAML SSO 身份验证

我目前正在开发 AngularJS 前端和 Django REST 后端。我一直在使用django-rest-auth来验证两者之间的连接,但现在必须使用 SAML 集成 SSO 身份验证。

我环顾四周并决定使用python3-saml,但任何文档和用例示例(针对此包和任何其他包)都适用于纯 Django 应用程序。

我一直以 OneLogin 的django/flask 指南为基础,并尝试制作一个自定义中间件来捕获我的请求,但 OneLogin 提供的重定向的实现不适用于 REST 调用(显然)。我还看到一些人使用 AUTHENTICATION_BACKENDS Django 设置,我想知道这是否是我想要的。

感谢您的任何帮助。

authentication django saml single-sign-on django-rest-framework

3
推荐指数
1
解决办法
5888
查看次数

如何在基于 SimpleSAMLphp 的 IdP 中用属性替换 NameId 的值?

我正在尝试设置 SimpleSAMLphp IdP 以将 SAML 响应发送到我的本地开发服务器(在本例中是 SP 发起的流程)。该 IdP 基于https://hub.docker.com/r/kristophjunge/test-saml-idp/的 Docker 映像 (我相信版本 1.15)。

整个设置是为了模拟一个与我拥有的类似环境,其中 G Suite IdP 用于相同的本地开发 SP - 试图最终消除我的本地开发环境中的云依赖性,并将其替换为等效的 SimpleSAMLphp 环境。

我遇到的问题是 Google 在其 SAML 响应中发送 NameId,如下所示:

<saml2:Subject> 
    <saml2:NameID Format="urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified">a.b@c.com</saml2:NameID> 
                  <saml2:SubjectConfirmation Method="urn:oasis:names:tc:SAML:2.0:cm:bearer"> 
                     <saml2:SubjectConfirmationData InResponseTo="ONELOGIN_88ebd953f02c07d01b19714cd70133827ff1228e" NotOnOrAfter="2018-05-07T20:21:25.433Z" .                         Recipient="https://ee0138c4.ngrok.io/saml/?acs" /> 
</saml2:SubjectConfirmation>
</saml2:Subject>
Run Code Online (Sandbox Code Playgroud)

但 SimpleSAMLphp 则以这种格式发送:

<saml:Subject> 
<saml:NameID SPNameQualifier="https://ee0138c4.ngrok.io/saml/metadata" Format="urn:oasis:names:tc:SAML:2.0:nameid-format:transient">_69d05500bd6e797de3674df0165facbfa0af699589</saml:NameID> 
<saml:SubjectConfirmation Method="urn:oasis:names:tc:SAML:2.0:cm:bearer"> <saml:SubjectConfirmationData NotOnOrAfter="2018-05-09T17:47:57Z" Recipient="https://ee0138c4.ngrok.io/saml/?acs" InResponseTo="ONELOGIN_170bb7a0ff82100318ba498583e8e59cdae8607b" /> 
</saml:SubjectConfirmation> 
</saml:Subject>
Run Code Online (Sandbox Code Playgroud)

我需要它作为一个属性值

ab@c.com而不是_69d05500bd6e797de3674df0165facbfa0af699589

然后我可以在 SP 的逻辑中获取它,而不是发送一些随机数,我假设它是瞬态 ID。

这是我的配置:

启动 Docker 容器:

docker run --name=testsamlidp_idp \
-p …
Run Code Online (Sandbox Code Playgroud)

php saml saml-2.0 docker simplesamlphp

3
推荐指数
1
解决办法
2041
查看次数

使用 PHP 的 SAML 2.0 身份验证

我们有一个用 PHP 和 MySQL 创建的网站,用户可以在其中注册和登录。最近,我的客户给了我一些第三方服务/网站,这些服务/网站也要求用户登录才能访问他们的服务。现在,我的客户希望,如果用户已经登录到我们的网站,并且当我们将用户重定向到其他/第三方网站时,它不应该要求输入密码或再次登录。当我与第 3 方网站交谈以提供此解决方案时,他们要求我实施/使用 SAML 2.0 SSO 选项来实现此功能。虽然,我听说过 auth0 和 SAML,但我不知道应该从哪里开始。

  1. 我需要在我们的网站上添加一些内容吗?喜欢 auth0 服务吗?
  2. 我是否需要向他们提出一些要求才能实现这一点?我需要做出哪些改变?
  3. 当我们将用户重定向到第三方网站时,它将自动登录或其他什么,这将涉及哪些步骤?

php saml

3
推荐指数
1
解决办法
2万
查看次数

无法导入 springframework.security.extensions 并找到 saml() 方法

org.springframework.security.extensions.saml2.config.SAMLConfigurer 不存在

至少我不能在我的安全配置类中导入org.springframework.security.extensions.saml2.config.SAMLConfigurer方法saml()尚未定义。

SecurityConfiguration.java的源代码:

    package com.hem.configuration;

    import com.hem.properties.ServerProxy;
    import com.hem.properties.ServerSsl;
    import org.springframework.beans.factory.annotation.Autowired;
    import org.springframework.beans.factory.annotation.Value;
    import org.springframework.context.annotation.Configuration;
    import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;
    import org.springframework.security.config.annotation.web.builders.HttpSecurity;
    import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
    import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
 import org.springframework.security.extensions.saml2.config.SAMLConfigurer;

    @EnableWebSecurity
    @Configuration
    @EnableGlobalMethodSecurity(securedEnabled = true)
    public class SecurityConfiguration extends WebSecurityConfigurerAdapter {

        private static final String HTTPS = "https";

        @Value("${security.saml2.metadata-url}")
        private String metadataUrl;

        @Value("${saml.entity.id}")
        private String entityId;

        @Autowired
        private ServerProxy serverProxy;

        @Autowired
        private ServerSsl serverSsl;

        @Autowired
        private SAMLUserDetailsServiceImpl samlUserDetailsServiceImpl;

        @Override
        protected void configure(final HttpSecurity http) throws Exception {
            http
                .authorizeRequests() …
Run Code Online (Sandbox Code Playgroud)

java spring spring-security saml spring-saml

3
推荐指数
1
解决办法
1456
查看次数

OIDC IdP 提供商之上的代理,用于接受来自服务提供商的 SSO SAML 请求

上下文: 我们有一个无法控制的 OIDC IdP,但我们需要支持来自服务提供商 (SP) 的 SSO 的 SAML 请求。

想法: 构建位于 SP 和 OIDC 身份提供商之间的代理(应用程序)。来自 SP 的请求将发送到代理应用程序(充当 SP 的 SAML IdP),代理应用程序将请求转换为 OIDC 请求并将其转发到 OIDC 提供商。来自 OIDC 提供商的结果返回到代理应用程序,代理应用程序将其转换为 SAML 响应并将其转发到 SP。

问题:

我对 SAML IdP(实施方面)的了解非常有限。这种方法对我来说似乎很黑客:)感觉有很多事情我需要考虑。因此,对于我做错的地方需要一些帮助和指导。我想问的几件事是:

  • 这种方法有任何意义吗?
  • 这种方法的安全影响是什么?
  • 是否还有其他更简单/更好的解决方案或类似的用例?

任何形式的帮助将不胜感激。

谢谢!

saml single-sign-on openid-connect idp

3
推荐指数
1
解决办法
1481
查看次数

Spring Session 升级后的 InResponseToField 错误

由于 Spring Security SAML 的问题,我们无法从 Spring session 1.3.3 升级到 2.1.2。似乎 Spring Security SAML 无法验证 InResponseToField 值,因为正在创建两个会话 ID:

Caused by: org.opensaml.common.SAMLException: InResponseToField of the Response doesn't correspond to sent message abc7b9acgecbde41927g729143f1g2
Run Code Online (Sandbox Code Playgroud)

我扩展了 SAMLContextProvider 使用的 HttpSessionStorageFactory 并添加了一些日志记录以了解发生了什么:

INFO 18.12.2018 13:43:27:95 (SAMLDelegatingAuthenticationEntryPoint.java:commence:105) - Session ID before redirect: 205e92ea-7ff3-45be-bfd1-648c2ae8da8e
INFO 18.12.2018 13:43:27:111 (SamlAuthenticationConfig.java:storeMessage:413) - Storing message abc7b9acgecbde41927g729143f1g2 to session 205e92ea-7ff3-45be-bfd1-648c2ae8da8e
Run Code Online (Sandbox Code Playgroud)

[用户现在被重定向到 IdP,然后被发送回应用程序]

现在出现以下错误:

Caused by: org.opensaml.common.SAMLException: InResponseToField of the Response doesn't correspond to sent message abc7b9acgecbde41927g729143f1g2
Run Code Online (Sandbox Code Playgroud)

这也是我们记录的内容:

INFO 18.12.2018 13:43:27:466 (SamlAuthenticationConfig.java:retrieveMessage:429) - Message abc7b9acgecbde41927g729143f1g2 …
Run Code Online (Sandbox Code Playgroud)

spring-security saml redis jedis spring-session

3
推荐指数
1
解决办法
1649
查看次数

SAML SSO 密钥库证书的重要性

我是证书和密钥库的新手。

SAML SSO 的密钥库和证书的重要性和工作原理是什么(在 Spring boot SAML SSO 的上下文中)?

我看到.jks.pem.cer.der等正在使用。这些是什么?

saml x509certificate single-sign-on spring-boot spring-saml

3
推荐指数
1
解决办法
5150
查看次数

SameSite 属性中断 SAML 流程

Chrome 80 将引入一个新属性,即 SameSite。

  • 严格 - 只为“同一站点”请求附加 cookie。
  • 松散 - 为“同站点”请求发送 cookie,以及使用安全 HTTP 方法(例如(GET HEAD OPTIONS TRACE))的“跨站点”顶级导航。
  • 无 - 为所有“同一站点”和“跨站点”请求发送 cookie。

有关更多信息,这篇文章很好地解释了 SameSite。

从 Azure 文档:

云服务(服务提供商)使用 HTTP 重定向绑定将 AuthnRequest(身份验证请求)元素传递给 Azure AD(身份提供商)。然后,Azure AD 使用 HTTP 发布绑定将 Response 元素发布到云服务

我的问题是为什么 SameSite 会破坏 SAML 流程?“saml”同站问题

当 IdP POST 响应回 SP 时,如果 SameSite=Lax,用户代理将不会发送具有 SP 域的 cookie。即使它不发送 cookie,我也不认为 SP 有任何问题。

cookies saml shibboleth saml-2.0 spring-saml

3
推荐指数
2
解决办法
3078
查看次数