CAS ReST - Adding New Service

72 views
Skip to first unread message

Yashwant Anandan

unread,
Apr 27, 2017, 3:02:39 AM4/27/17
to CAS Community
Hi,

I am trying to add a new service via the CAS ReST Service. I have a few doubts

1. What should be attributeName and attributeValue ? I have kept it as "skip" and "enabled.+" respectively.
2. I am getting "Request is not authorized" when I give a request to add a service. I thought it could be because of TGT, but I found that TGT is not the issue here. How to solve this ?

Rogério Biondi

unread,
Apr 25, 2019, 10:20:46 AM4/25/19
to CAS Community
I'm facing the same issue. Does anyone figured out how to configure the properties:

cas.rest.attributeName=
cas.rest.attributeValue=


I'm using CAS version 6.0.x and authentication via jdbc/query. My properties os cas.properties are:

cas.authn.jdbc.query[0].sql=SELECT * FROM `users` WHERE `user`=?
cas.authn.jdbc.query[0].url=jdbc:mysql://*****:3306/db
cas.authn.jdbc.query[0].driverClass=com.mysql.cj.jdbc.Driver
cas.authn.jdbc.query[0].dialect=org.hibernate.dialect.MySQL57InnoDBDialect
cas.authn.jdbc.query[0].user=user
cas.authn.jdbc.query[0].password=****
cas.authn.jdbc.query[0].autocommit=true
cas.authn.jdbc.query[0].fieldPassword=password
cas.authn.jdbc.query[0].passwordEncoder.type=DEFAULT
cas.authn.jdbc.query[0].passwordEncoder.encodingAlgorithm=MD5
cas.authn.jdbc.query[0].passwordEncoder.characterEncoding=UTF-8
cas.authn.jdbc.query[0].order=0


Best regards,
Rogério

Rogério Biondi

unread,
Apr 25, 2019, 10:59:22 AM4/25/19
to CAS Community
When calling the REST endpoint, I´ve passed the credentials using the basic authentication header.
The user:password has been encoded in Base64.
My REST call is as follows:

curl -X POST \
  -H 'Authorization: Basic cm9nZXJpby5iaW9uZGlAbHVpemFsYWJzLmNvbTpwYXNz' \
  -H 'Content-Type: application/json' \
  -H 'cache-control: no-cache' \
  -d '{
  "@class" : "org.apereo.cas.services.RegexRegisteredService",
  "serviceId" : "test",
  "name" : "test",
  "id" : 1,
  "description": "Teste"
}'


When calling the message in the log confirms that the user is authenticated:

2019-04-25 11:51:30,371 INFO [org.apereo.cas.authentication.PolicyBasedAuthenticationManager] - <Authenticated princi
pal [us...@lalala.com] with attributes [{}] via credentials [[UsernamePasswordCredential(username=us...@lalala.com, source=null, customFields={})]].>
2019-04-25 11:51:30,371 INFO [org.apereo.inspektr.audit.support.Slf4jLoggingAuditTrailManager] - <Audit trail record BEGIN
=============================================================
WHAT: Supplied credentials: [UsernamePasswordCredential(username=us...@lalala.com, source=null, customFields={})]
ACTION: AUTHENTICATION_SUCCESS
APPLICATION: CAS
WHEN: Thu Apr 25 11:51:30 BRT 2019
CLIENT IP ADDRESS: 0:0:0:0:0:0:0:1
SERVER IP ADDRESS: 0:0:0:0:0:0:0:1
=============================================================
CLIENT IP ADDRESS: 0:0:0:0:0:0:0:1
SERVER IP ADDRESS: 0:0:0:0:0:0:0:1
=============================================================

But I'm getting the error "Request is not authorized" in the REST client.

Has someone faced this issue? Any help?

Thank you very much.

Best regards,
Rogerio
Reply all
Reply to author
Forward
0 new messages