gpt4 book ai didi

apache - 使用 mod_auth_openidc 对自定义 Web 应用程序进行身份验证

转载 作者:行者123 更新时间:2023-12-02 04:11:11 26 4
gpt4 key购买 nike

我有一个在 apache 2.2 上运行的基本 Web 应用程序,没有任何身份验证。网站内容是静态网页。
我们的小组织目前正在致力于为所有网站实现 mod_auth_openidc
我想在基本静态 Web 应用程序之上实现 mod_auth_openidc 身份验证。

我怎样才能实现它?
我是 apache 配置和 mod_auth_openidc 的新手。我在谷歌上搜索了一些文章来实现它,但我找不到任何文章。我已在 Oauth2 服务器上为我的应用程序创建了一个静态帐户。

有人可以指导我如何使用 mod_auth_openidcmod_proxy 配置为我的静态网页应用程序启用身份验证吗?

<Location />
AuthType openid-connect
Require valid-user
</Location>
OIDCProviderMetadataURL https://example.com/fss/.well-known/openid-configuration
OIDCClientID ExampleCorp_Prod_web01
OIDCClientSecret <client-secret>
OIDCRedirectURI http://<ip>/redirect_uri
OIDCScope "profile openid"
OIDCCryptoPassphrase example@3003
OIDCCookiePath /
ProxyPass / http://<ip>:8080/ nocanon
ProxyPassReverse / http://<ip>:8080/
ProxyRequests Off
AllowEncodedSlashes on
<Proxy http://<ip>:8080/*>
</Proxy>
OIDCAuthNHeader X-Forwarded-User
OIDCRemoteUserClaim sub
OIDCClaimPrefix example_
LoadModule auth_openidc_module modules/mod_auth_openidc.so

最佳答案

Github 项目页面上的自述文件中有示例:https://github.com/zmartzone/mod_auth_openidc 。假设静态网页位于 /example 上,在您的特定 (PingFederate) 示例中,它将类似于:

OIDCProviderMetadataURL https://<pingfederate-host>:9031/.well-known/openid-configuration

OIDCClientID <client-id-as-registered-with-pingfederate>
OIDCClientSecret <client-secret-as-registered-with-pingfederate>

OIDCRedirectURI https://<your-apache-host>/example/redirect_uri/
OIDCCryptoPassphrase <password>
OIDCScope "openid email profile"

<Location /example/>
AuthType openid-connect
Require valid-user
</Location>

基于OPs环境的完整工作示例:

Listen 80
User www
Group www
DocumentRoot /opt/local/apache2/htdocs/
ErrorLog "logs/error_log"
LogLevel info
ServerName example.org

LoadModule ssl_module modules/mod_ssl.so
LoadModule authz_user_module modules/mod_authz_user.so
LoadModule auth_openidc_module modules/mod_auth_openidc.so

LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_http_module modules/mod_proxy_http.so

<Location />
AuthType openid-connect
Require valid-user
</Location>

OIDCProviderMetadataURL https://accounts.google.com/.well-known/openid-configuration
OIDCClientID myclientid
OIDCClientSecret mysecret
OIDCRedirectURI http://example.org/protected/
OIDCScope "profile openid"
OIDCCryptoPassphrase example@3003
OIDCCookiePath /

ProxyPass / http://192.168.10.1:80/ nocanon
ProxyPassReverse / http://192.168.10.1:80/
ProxyRequests Off
AllowEncodedSlashes on
<Proxy http://192.168.10.1:8080/*>
</Proxy>

OIDCAuthNHeader X-Forwarded-User
OIDCRemoteUserClaim sub
OIDCClaimPrefix example_

关于apache - 使用 mod_auth_openidc 对自定义 Web 应用程序进行身份验证,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36658956/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com