Liferay登录ca后显示白页
Liferay shows white page after login to cas
我已经安装了 cas-overlay-template-master tomcat 9.0.41 侦听 8080 由 nginx 代理侦听 443 在名为 cas.mydomain.net
的域中使用 letsencrypt 创建的 ssl目前有效。
在以下目录
/opt/cas/apache-tomcat-9.0.41/cas/
和 /opt/cas/apache-tomcat-9.0.41/conf/server.xml
中的主机
<Host name="cas.mydomain.net" appBase="cas" unpackWARs="true" autoDeploy="true">
<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
prefix="cas.mydomain.net_access_log" suffix=".txt"
pattern="%h %l %u %t "%r" %s %b" />
</Host>
我创建了一个名为 /etc/cas/config/services/myliferay-1001.json
的文件,其中包含以下内容
{
@class: org.apereo.cas.services.RegexRegisteredService
serviceId: https://myliferay.mydomain.net/c/portal/login.*
name: myliferay
id: 1001
proxyTicketExpirationPolicy:
{
@class: org.apereo.cas.services.DefaultRegisteredServiceProxyTicketExpirationPolicy
}
serviceTicketExpirationPolicy:
{
@class: org.apereo.cas.services.DefaultRegisteredServiceServiceTicketExpirationPolicy
}
evaluationOrder: 1
logoutType: FRONT_CHANNEL
attributeReleasePolicy:
{
@class: org.apereo.cas.services.DenyAllAttributeReleasePolicy
}
logoutUrl: https://cas.mydomain.net/logout
}
我还将 cas 连接到一个 postgres 数据库中,将以下内容放入 /etc/cas/config/cas.properties
cas.server.name=https://cas.mydomain.net
cas.server.prefix=${cas.server.name}
logging.config=file:/etc/cas/config/log4j2.xml
Log4jContextSelector=org.apache.logging.log4j.core.async.AsyncLoggerContextSelector
cas.authn.accept.users=
cas.authn.jdbc.query[0].driver-class=org.postgresql.Driver
cas.authn.jdbc.query[0].url=jdbc:postgresql://localhost:5432/cas
cas.authn.jdbc.query[0].dialect=org.hibernate.dialect.PostgreSQL95Dialect
cas.authn.jdbc.query[0].driver-class=org.postgresql.Driver
cas.authn.jdbc.query[0].user=postgres
cas.authn.jdbc.query[0].password=
cas.authn.jdbc.query[0].sql=SELECT * FROM users WHERE emailaddress = ?
cas.authn.jdbc.query[0].password-encoder.type=DEFAULT
cas.authn.jdbc.query[0].password-encoder.encoding-algorithm=MD5
cas.authn.jdbc.query[0].field-password=password
cas.authn.jdbc.query[0].field-expired=expired
cas.authn.jdbc.query[0].field-disabled=disabled
我创建了 table 个用户和一个具有特定电子邮件和密码的用户,我可以从网络登录...一切正常!
我还安装了 liferay-dxp 7.3,它带有 tomcat 9.0.37 侦听 8081,由 nginx 侦听域 myliferay.mydomain.net
下的 443 代理,还带有使用 letsencrypt 创建的 ssl目前有效。
在以下目录
/opt/liferay/
和 /opt/liferay/tomcat-9.0.37/conf/server.xml
中的主机
<Host name="myliferay.mydomain.net" appBase="webapps" unpackWARs="true" autoDeploy="true">
<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
prefix="myliferay.mydomain.net_access_log" suffix=".txt"
pattern="%h %l %u %t "%r" %s %b" />
</Host>
安装 liferay 我在 localhost/iportal 上选择了预定义的 postgres 数据库。
在 liferay 中创建了一个用户,我选择使用与我在 cas db
中使用的相同的电子邮件和密码
在liferay中control panel -> system settings -> sso -> cas
我做了如下设置
Enable - Checked
Import from LDPA: Unchecked
Login URL: https://cas.mydomain.net
Logout on Session Expiration: Unchecked
Logout URL: https://cas.mydomain.net/logout
Server Name: https://myliferay.mydomain.net
Server URL: https://cas.mydomain.net
Service URL: https://myliferay.mydomain.net/c/portal/login
No Such User Redirect URL: https://myliferay.mydomain.net
现在我浏览到 https://myliferay.mydomain.net
并单击右上角的 Sign In
,这将我重定向到
https://cas.mydomain.net/login?service=https%3A%2F%2Fmyliferay.mydomain.net%2Fc%2Fportal%2Flogin
并向我展示了 Cas 登录屏幕。
当我使用随机电子邮件或密码时,cas 按预期显示登录屏幕。
如果我使用正确的电子邮件和密码,它会将我重定向到
https://myliferay.mydomain.net/c/portal/login?ticket=ST-21-[arandomstring]-[myserverhostname]
这是一个空白页面,而且如果我浏览到 https://myliferay.mydomain.net
,我仍然会退出。
如果我再次点击登录,我会立即被重定向到 cas.mydomain.net 并返回到
https://myliferay.mydomain.net/c/portal/login?ticket=ST-22-[arandomstring]-[myserverhostname]
这意味着cas已经知道我是谁但是
就像liferay不知道如何处理请求
中的ticket parameter
我应该在某处创建任何其他文件吗?
我是否应该以某种方式为每个 tomcat 安装安装 cas.mydomain.net or/and myliferay.mydomain.net ssl 证书?
我应该在 liferay 的控制面板中进行任何其他设置吗?
如有任何帮助,我们将不胜感激!
我通过在 webapps/ROOT/WEB-INF/classes/portal-ext.properties
中放置以下两行使其工作
auto.login.hooks=com.liferay.portal.security.auth.BasicAutoLogin
auto.login.hooks=com.liferay.portal.security.auth.BasicAutoLogin,com.liferay.portal.security.auth.CASAutoLogin
并在 com.liferay.filters.ss.cas.CASFilter
下一行
com.liferay.filters.sso.cas.CASFilter=true
我已经安装了 cas-overlay-template-master tomcat 9.0.41 侦听 8080 由 nginx 代理侦听 443 在名为 cas.mydomain.net
的域中使用 letsencrypt 创建的 ssl目前有效。
在以下目录
/opt/cas/apache-tomcat-9.0.41/cas/
和 /opt/cas/apache-tomcat-9.0.41/conf/server.xml
<Host name="cas.mydomain.net" appBase="cas" unpackWARs="true" autoDeploy="true">
<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
prefix="cas.mydomain.net_access_log" suffix=".txt"
pattern="%h %l %u %t "%r" %s %b" />
</Host>
我创建了一个名为 /etc/cas/config/services/myliferay-1001.json
的文件,其中包含以下内容
{
@class: org.apereo.cas.services.RegexRegisteredService
serviceId: https://myliferay.mydomain.net/c/portal/login.*
name: myliferay
id: 1001
proxyTicketExpirationPolicy:
{
@class: org.apereo.cas.services.DefaultRegisteredServiceProxyTicketExpirationPolicy
}
serviceTicketExpirationPolicy:
{
@class: org.apereo.cas.services.DefaultRegisteredServiceServiceTicketExpirationPolicy
}
evaluationOrder: 1
logoutType: FRONT_CHANNEL
attributeReleasePolicy:
{
@class: org.apereo.cas.services.DenyAllAttributeReleasePolicy
}
logoutUrl: https://cas.mydomain.net/logout
}
我还将 cas 连接到一个 postgres 数据库中,将以下内容放入 /etc/cas/config/cas.properties
cas.server.name=https://cas.mydomain.net
cas.server.prefix=${cas.server.name}
logging.config=file:/etc/cas/config/log4j2.xml
Log4jContextSelector=org.apache.logging.log4j.core.async.AsyncLoggerContextSelector
cas.authn.accept.users=
cas.authn.jdbc.query[0].driver-class=org.postgresql.Driver
cas.authn.jdbc.query[0].url=jdbc:postgresql://localhost:5432/cas
cas.authn.jdbc.query[0].dialect=org.hibernate.dialect.PostgreSQL95Dialect
cas.authn.jdbc.query[0].driver-class=org.postgresql.Driver
cas.authn.jdbc.query[0].user=postgres
cas.authn.jdbc.query[0].password=
cas.authn.jdbc.query[0].sql=SELECT * FROM users WHERE emailaddress = ?
cas.authn.jdbc.query[0].password-encoder.type=DEFAULT
cas.authn.jdbc.query[0].password-encoder.encoding-algorithm=MD5
cas.authn.jdbc.query[0].field-password=password
cas.authn.jdbc.query[0].field-expired=expired
cas.authn.jdbc.query[0].field-disabled=disabled
我创建了 table 个用户和一个具有特定电子邮件和密码的用户,我可以从网络登录...一切正常!
我还安装了 liferay-dxp 7.3,它带有 tomcat 9.0.37 侦听 8081,由 nginx 侦听域 myliferay.mydomain.net
下的 443 代理,还带有使用 letsencrypt 创建的 ssl目前有效。
在以下目录
/opt/liferay/
和 /opt/liferay/tomcat-9.0.37/conf/server.xml
<Host name="myliferay.mydomain.net" appBase="webapps" unpackWARs="true" autoDeploy="true">
<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
prefix="myliferay.mydomain.net_access_log" suffix=".txt"
pattern="%h %l %u %t "%r" %s %b" />
</Host>
安装 liferay 我在 localhost/iportal 上选择了预定义的 postgres 数据库。 在 liferay 中创建了一个用户,我选择使用与我在 cas db
中使用的相同的电子邮件和密码在liferay中control panel -> system settings -> sso -> cas
我做了如下设置
Enable - Checked
Import from LDPA: Unchecked
Login URL: https://cas.mydomain.net
Logout on Session Expiration: Unchecked
Logout URL: https://cas.mydomain.net/logout
Server Name: https://myliferay.mydomain.net
Server URL: https://cas.mydomain.net
Service URL: https://myliferay.mydomain.net/c/portal/login
No Such User Redirect URL: https://myliferay.mydomain.net
现在我浏览到 https://myliferay.mydomain.net
并单击右上角的 Sign In
,这将我重定向到
https://cas.mydomain.net/login?service=https%3A%2F%2Fmyliferay.mydomain.net%2Fc%2Fportal%2Flogin
并向我展示了 Cas 登录屏幕。
当我使用随机电子邮件或密码时,cas 按预期显示登录屏幕。
如果我使用正确的电子邮件和密码,它会将我重定向到
https://myliferay.mydomain.net/c/portal/login?ticket=ST-21-[arandomstring]-[myserverhostname]
这是一个空白页面,而且如果我浏览到 https://myliferay.mydomain.net
,我仍然会退出。
如果我再次点击登录,我会立即被重定向到 cas.mydomain.net 并返回到
https://myliferay.mydomain.net/c/portal/login?ticket=ST-22-[arandomstring]-[myserverhostname]
这意味着cas已经知道我是谁但是 就像liferay不知道如何处理请求
中的ticket parameter
我应该在某处创建任何其他文件吗? 我是否应该以某种方式为每个 tomcat 安装安装 cas.mydomain.net or/and myliferay.mydomain.net ssl 证书? 我应该在 liferay 的控制面板中进行任何其他设置吗?
如有任何帮助,我们将不胜感激!
我通过在 webapps/ROOT/WEB-INF/classes/portal-ext.properties
auto.login.hooks=com.liferay.portal.security.auth.BasicAutoLogin
auto.login.hooks=com.liferay.portal.security.auth.BasicAutoLogin,com.liferay.portal.security.auth.CASAutoLogin
并在 com.liferay.filters.ss.cas.CASFilter
下一行
com.liferay.filters.sso.cas.CASFilter=true