小编Ulr*_*alt的帖子

Apache,mod_auth_kerb,mod_proxy:在Go Web应用程序中获取经过身份验证的用户

我将Apache用作反向代理,以进行go http服务器前的身份验证之类的操作。

以下apache kerberos设置只能解决一个问题。我不知道如何在我的go应用程序中获取经过身份验证的用户名。

httpd.conf:

<VirtualHost host.domain.com:80>
  ProxyPreserveHost On
  ProxyPass / http://127.0.0.1:9000/
  ProxyPassReverse / http://127.0.0.1:9000/

  <Location />
    ## gzip
    ##
    AddOutputFilterByType DEFLATE text/html

    Order                      deny,allow
    Allow                      from all

    AuthType                   Kerberos
    AuthName                   "User Admin"
    KrbAuthRealms              DOMAIN.COM
    Krb5Keytab                 /etc/host.krb5keytab
    KrbMethodNegotiate         on
    KrbAuthoritative           on
    KrbMethodK5Passwd          off
    KrbLocalUserMapping on
    KrbSaveCredentials         on
    require valid-user
  </Location>
</VirtualHost>
Run Code Online (Sandbox Code Playgroud)

 AuthType                    basic
Run Code Online (Sandbox Code Playgroud)

我使用go函数从请求的Authorization标头中获取用户名

func (*Request) BasicAuth
Run Code Online (Sandbox Code Playgroud)

但是与Authorization标头协商不可能。此外,由于没有cgi环境,因此我无法使用REMOTE_USER环境变量。我也尝试设置RequestHeader,但是没有成功。

是否有可能从go应用程序中获取授权的用户名?

apache mod-proxy go mod-auth-kerb

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

标签 统计

apache ×1

go ×1

mod-auth-kerb ×1

mod-proxy ×1