【问题标题】:How to use header authentication with DataZen?如何在 DataZen 中使用标头身份验证?
【发布时间】:2015-07-09 11:15:58
【问题描述】:

我们正在使用DataZen 通过仪表板可视化一些数据。

我们想使用标头身份验证,但文档没有提供任何信息,可以使用 external_auth_key 设置哪个标头字段。

有人知道在使用DataZen的头认证时要设置哪些头字段吗?

【问题讨论】:

    标签: http authentication dashboard datazen-server


    【解决方案1】:

    快速前言:这个功能真的不应该使用。它没有很好地记录,因为它几乎从来都不是设置服务器的正确方法。您应该始终认真考虑替代方案,例如默认模式(Datazen 为您处理凭据)或更好的 Active Directory 联合服务。

    外部身份验证是一种相对不安全的方法,因为所有信任都放在代理上。除非您绝对需要它并且您没有使用 Active Directory,否则通常应该避免使用它。


    您必须告诉 Datazen 要查找哪个标头或 cookie。您可以通过控制面板 UI 执行此操作。

    请注意,“身份验证密钥”设置区分大小写,因此我通常建议使用全部小写的内容。

    设置好该设置后,只需转到您的代理(以您选择实施的任何形式)并设置一个具有该名称的标头,以及应验证的 1:1 Datazen 用户名。

    例如,如果我使用上述设置登录代理,代理应该发出以下请求:

    GET /viewer HTTP/1.1
    thisistheheadername: v-mhauge
    ...
    

    读取该标头后,Datazen 服务器将响应该用户已登录。

    免责声明:我是 Microsoft 的支持工程师,为支持 Datazen 付费。

    【讨论】:

      【解决方案2】:

      更改服务配置:

      <add key="authtype" value="external" />
      <add key="external_auth_type" value="header" />
      <add key="external_auth_key" value="zabr" />
      

      重新启动服务。 在 datazen 中创建的用户:zabr。 授予用户的权限:zabr。

      改变了 nginx:

                  location / {
                          proxy_pass http://tfs10.domain.ru:81/;
                          proxy_set_header zabr 'zabr';
                  }
      

      结果 ==> 成功了!

      【讨论】:

        【解决方案3】:

        我能够通过 fiddler 传递标头信息,并且它似乎可以工作,但我无法终生弄清楚如何通过带有 iframe 中的引用站点的 asp Web 应用程序传递它。我已经创建了这个类,但标题只是以某种方式丢失了这个。

        Public Class CustomHttpModule
            Implements IHttpModule
        
            Public Sub New()
                ' Class constructor.
            End Sub
        
        
            ' Classes that inherit IHttpModule 
            ' must implement the Init and Dispose methods.
            Public Sub Init(ByVal app As HttpApplication) Implements IHttpModule.Init
                AddHandler app.BeginRequest, AddressOf app_BeginRequest
            End Sub
        
        
            Public Sub Dispose() Implements IHttpModule.Dispose
                ' Add code to clean up the
                ' instance variables of a module.
            End Sub
        
            Public Sub app_BeginRequest(ByVal o As Object, ByVal ea As EventArgs)
                Dim user As New ArrayList
                Dim headers As NameValueCollection = HttpContext.Current.Request.Headers
                Dim t As Type = headers.GetType()
                t.InvokeMember("MakeReadWrite", System.Reflection.BindingFlags.InvokeMethod Or System.Reflection.BindingFlags.NonPublic Or System.Reflection.BindingFlags.Instance, Nothing, headers, Nothing)
                t.InvokeMember("InvalidateCachedArrays", System.Reflection.BindingFlags.InvokeMethod Or System.Reflection.BindingFlags.NonPublic Or System.Reflection.BindingFlags.Instance, Nothing, headers, Nothing)
                user.Add("username")
                t.InvokeMember("BaseAdd", System.Reflection.BindingFlags.InvokeMethod Or System.Reflection.BindingFlags.NonPublic Or System.Reflection.BindingFlags.Instance, Nothing, headers, New Object() {"headerkey", user})
                t.InvokeMember("MakeReadOnly", System.Reflection.BindingFlags.InvokeMethod Or System.Reflection.BindingFlags.NonPublic Or System.Reflection.BindingFlags.Instance, Nothing, headers, Nothing)
            End Sub
        
        End Class

        我也能够通过 ASP 成功地进行网络请求,但是如何使用 iframe 来做这件事超出了我的能力范围。..

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 2016-05-10
          • 2021-04-28
          • 2015-09-09
          • 2020-02-12
          • 2021-10-28
          • 1970-01-01
          • 2019-09-20
          • 2015-01-03
          相关资源
          最近更新 更多