2016-04-16 13 views
1

Ich habe eine grundlegende Webanwendung, die auf Apache 2.2 ausgeführt wird und keine Authentifizierung hat. Der Seiteninhalt ist eine statische Webseite. Unsere kleine Organisation arbeitet derzeit daran, mod_auth_openidc für alle Websites zu implementieren. Ich wollte die Authentifizierung mod_auth_openidc zusätzlich zur grundlegenden statischen Webanwendung implementieren. Wie kann ich es erreichen? Ich bin Neuling Apache Konfiguration und mod_auth_openidc. Ich habe für einige Artikel gegoogelt, um es zu implementieren, aber ich konnte keine finden. Ich habe ein statisches Konto für meine Anwendung auf Oauth2 Server erstellt. Kann mir jemand in die richtige Richtung zeigen, wie ich die Authentifizierung für meine statische Webseitenanwendung mit der Konfiguration mod_auth_openidc und mod_proxy aktivieren kann? Danke im Voraus.Authentifizierung für benutzerdefinierte Webanwendung mit mod_auth_openidc

<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 [email protected] 
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 
+0

welche Anbieter würden Sie konfigurieren gegen ? –

+0

Hallo Hans, wir benutzen pingfederate – Tommy

Antwort

2

Es gibt Beispiele in der Readme auf den Github Projektseiten: https://github.com/pingidentity/mod_auth_openidc. Unter der Annahme, die statischen Webseiten lebt /example, in Ihrem speziellen (PingFederate) Beispiel wäre es so etwas wie:

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> 

Ein komplettes Arbeitsbeispiel auf der Grundlage der Umgebung 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 [email protected] 
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_ 
+0

Hallo Hans, danke für die bereitgestellten Informationen. Ich versuche eine Hallo-Welt-Seite hinter dem Openidc-Login zu verwenden. Ich habe ein Beispiel aus openidc wiki 10 verwendet. – Tommy

+0

ich benutze die unten URL für die Konfiguration einer Hallo Welt Webseite mit mod_auth_openidc + mod_proxy + Hallo Welt Programm https://github.com/pingidentity/mod_auth_openidc/wiki#10-can- Sie-zeigen-mir-eine-einfache-Anwendung. aber ich sehe "401 Autorisierungsfehler" – Tommy

+0

und Protokolle zeigen mir oidc_unsolicited_proto_state: konnte JWT nicht vom Zustand analysieren: ungültige unaufgeforderte Antwort: [src/jose/apr_jwt.c: 177: apr_jwt_base64url_decode_object]: JSON Parsing (json_loads) ist gescheitert: '[ 'oder' {'erwartet nahe' l '(l \\\ xb4 \ xe7r \ x12 \ x97 \ xec \ x1e \ x1d \ xea \ xde \ x8az \ xe5 | \ xccb \ xf0 \ xcd) \ n oidc_authorisation_response_match_state: nicht möglich Wiederherstellungsstatus oidc_handle_authorization_response: Ungültiger Autorisierungsantwortzustand und keine Standard-SSO-URL ist gesetzt, es wird ein Fehler gesendet ... sehr bedauerlicherweise für das gemischte Protokoll und die kurzen Kommentare. Ich kann keine neue Zeile für jeden Kommentar erstellen – Tommy