我已为CAS启用REST支持。 我正在执行的步骤
1。通过提供有效的用户名和密码,从URL [https://localhost:8443/cas/v1/tickets][1]生成TGT 我能够成功生成TGT,我的响应如下所示
<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML 2.0//EN\">
<html>
<head>
<title>201 Created</title>
</head>
<body>
<h1>TGT Created</h1>
<form action="https://localhost:8443/cas/v1/tickets/TGT-1-CRvO3iDuXrLvpQAuFNpM5rOCfCAaXInbWk6sA2IGH4l1xBnormNsvjiTWvIJU-eGZOgbijulal" method="POST">Service:
<input type="text" name="service" value="">
<br>
<input type="submit" value="Submit">
</form>
</body>
</html>
2。在TGT之上,我将通过在请求标头中提供服务URL来生成服务票证
点击上述URL后,我得到了服务票(ST)-ST-3-0P6pxvJk0T-6N2ywcUhWiLPCb7obijulal
但是当我尝试访问我的服务
http://localhost/moodle/login/index.php?ticket=ST-3-0P6pxvJk0T-6N2ywcUhWiLPCb7obijulal
我在浏览器中遇到以下错误
Exception - CAS URL: https://localhost:8443/cas/validate?service=http%3A%2F%2Flocalhost%2Fmoodle%2Flogin%2Findex.php%3Fs&ticket=ST-3-0P6pxvJk0T-6N2ywcUhWiLPCb7obijulal Authentication failure: CAS 1.0 ticket not validated Reason: no response from the CAS server
More information about this error
我的日志显示以下错误
2019-10-02 21:46:35,020 WARN [org.apereo.cas.DefaultCentralAuthenticationService] - <Service ticket [ST-3-0P6pxvJk0T-6N2ywcUhWiLPCb7obijulal] does not exist.>
2019-10-02 21:46:35,020 INFO [org.apereo.inspektr.audit.support.Slf4jLoggingAuditTrailManager] - <Audit trail record BEGIN
=============================================================
WHO: audit:unknown
WHAT: ST-3-0P6pxvJk0T-6N2ywcUhWiLPCb7obijulal for http://localhost/moodle/login/index.php
ACTION: SERVICE_TICKET_VALIDATE_FAILED
APPLICATION: CAS
WHEN: Wed Oct 02 21:46:35 IST 2019
CLIENT IP ADDRESS: 127.0.0.1
SERVER IP ADDRESS: 127.0.0.1
=============================================================
我的cas.properties文件
cas.server.name: https://localhost:8443
cas.server.prefix: https://localhost:8443/cas
cas.adminPagesSecurity.ip=127.0.0.1
logging.config: file:/etc/cas/config/log4j2.xml
cas.serviceRegistry.json.location=file:/etc/cas/services
database.driverClass=org.postgresql.Driver
database.url=jdbc:mysql://localhost:3306/cas?useUnicode=true&useJDBCCompliantTi$
cas.authn.jdbc.query[0].sql = SELECT cas_pw FROM cas_login WHERE cas_un=?
cas.authn.jdbc.query[0].healthQuery = SELECT 1
cas.authn.jdbc.query[0].driverClass = com.mysql.jdbc.Driver
cas.authn.jdbc.query[0].url = jdbc:mysql://localhost:3306/cas?useUnicode=true&u$
cas.authn.jdbc.query[0].user = moodleuser
cas.authn.jdbc.query[0].password =m00dlE
cas.authn.jdbc.query[0].dialect = org.hibernate.dialect.MySQLDialect
cas.authn.jdbc.query[0].fieldPassword = cas_pw
cas.tgc.path=/cas
cas.tgc.maxAge=-1
cas.tgc.domain=localhost
cas.tgc.name=TGC
cas.tgc.secure=false
cas.tgc.httpOnly=false
cas.ticket.tgt.timeout.maxTimeToLiveInSeconds=99999999
cas.ticket.tgt.maxTimeToLiveInSeconds=99999999
# Decides whether SSO Warning cookie should be created only under secure connec$
warn.cookie.secure=false
# The expiration value of the SSO Warning cookie
warn.cookie.maxAge=-1
# Set to a negative value to never expire tickets
cas.ticket.tgt.maxTimeToLiveInSeconds=-1
cas.ticket.tgt.timeToKillInSeconds=-1
cas.ticket.registry.jpa.ticketLockType=NONE
cas.ticket.registry.jpa.jpaLockingTimeout=3600
cas.ticket.registry.jpa.url=jdbc:mysql://localhost:3306/ticket?useUnicode=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverT$
cas.ticket.registry.jpa.dialect=org.hibernate.dialect.MySQLDialect
cas.ticket.registry.jpa.user=moodleuser
cas.ticket.registry.jpa.ddlAuto=create-drop
cas.ticket.registry.jpa.password=m00dlE
cas.ticket.registry.jpa.autocommit=false
cas.ticket.registry.jpa.driverClass=com.mysql.jdbc.Driver
cas.ticket.registry.jpa.idleTimeout=5000
cas.ticket.registry.jpa.dataSourceName=ticket
cas.ticket.registry.jpa.dataSourceProxy=false
cas.ticket.registry.jpa.pool.minSize=6
cas.ticket.registry.jpa.pool.maxSize=18
cas.ticket.registry.jpa.pool.maxWait=2000
请帮助我。谢谢!