Re: [cas-user] I am unable to connect with my MYsql Database and Application Not Authorized

2 views
Skip to first unread message

Ray Bon

unread,
May 22, 2024, 12:32:10 PMMay 22
to cas-...@apereo.org
Vijayawada,

Issue 2:
Usually 500s will have some logged failure reason (e.g. unable to connect to db). Turn up the logging level if necessary. 

Issue 1:
The service parameter sent to cas must match the serviceId (which can be a regular expression). Yours is very specific; moodle is probably sending some parameters.
Try
$ -> .*

To complete the authentication process, you will need certificates. Backend communication between a service and cas is only https. The certificates can be self signed. See https://apereo.github.io/cas/7.0.x/installation/Troubleshooting-Guide.html

Ray

On Tue, 2024-05-21 at 00:39 -0700, Vijayawada Wiki wrote:
You don't often get email from vijayaw...@gmail.com. Learn why this is important
JSON File:
{
    "@class": "org.apereo.cas.services.RegexRegisteredService",
    "serviceId": "^http://localhost/bitlabs/login/index.php$",
    "name": "Moodle",
    "id": 10000001,
    "description": "Moodle Service",
    "evaluationOrder": 1,
    "accessStrategy": {
      "@class": "org.apereo.cas.services.DefaultRegisteredServiceAccessStrategy",
      "enabled": true,
      "ssoEnabled": true
    }
  }
application.yml:
# Application properties that need to be
# embedded within the web application can be included here
server:
  port: 8443
  ssl:
    key-store: file:etc/cas/thekeystore
cas:
  tgc:
    crypto:
      encryption:
        key: v72HzSo4JrQl0wxj3PUleiqV5AO2thr63eSwv0oa1VE
      signing:
        key: 7OVwV-0Nw5jjUbznhKvBNut2r5w_P-L5foYLpjEvz-ZCQnJY2JMxuf3JeMJQjxN6oUjP3MMv2BFuP0jbhgQNgg
  authn:
    accept:
      enabled: true
    jdbc:
            query[0]:
                sql: SELECT * FROM mdl_users WHERE email = ?
                url: jdbc:mysql://localhost:3306/bitlabs
                dialect: org.hibernate.dialect.MySQLDialect
                user: root
                password:
                ddlAuto: none
                driverClass: com.mysql.cj.jdbc.Driver
                fieldPassword: password
                passwordEncoder:
                    type: NONE

cas.properties:

cas.server.prefix=${cas.server.name}/cas
server.ssl.key-store=file:/etc/cas/thekeystore
server.ssl.key-store-password=changeit
logging.config=file:/etc/cas/config/log4j2.xml
cas.service-registry.core.init-from-json=true
cas.serviceRegistry.json.location=file:/etc/cas/services
logging.level.org.apache.commons.logging=DEBUG


cas.authn.accept.users=
# Specify MySQL driver class
cas.authn.jdbc.query[0].driver-class=com.mysql.cj.jdbc.Driver

# Modify the JDBC URL to connect to your MySQL database
cas.authn.jdbc.query[0].url=jdbc:mysql://localhost:3306/bitlabs

# Specify MySQL dialect
cas.authn.jdbc.query[0].dialect=org.hibernate.dialect.MySQL57Dialect

# Specify MySQL database credentials (username and password)
cas.authn.jdbc.query[0].user=root
cas.authn.jdbc.query[0].password=

# Adjust SQL query to match MySQL syntax and table name
cas.authn.jdbc.query[0].sql=SELECT * FROM mdl_user WHERE email = ?

# Specify the password encoder type (assuming BCRYPT is still used)
cas.authn.jdbc.query[0].password-encoder.type=BCRYPT

# Specify the field names for password, expired, and disabled columns in your MySQL table
cas.authn.jdbc.query[0].field-password=password
cas.authn.jdbc.query[0].field-expired=expired
cas.authn.jdbc.query[0].field-disabled=disabled

I am facing 2 issues:

issue1:
Application Not Authorized to Use CAS

The application you attempted to authenticate to is not authorized to use CAS. This usually indicates that the application is not registered with CAS, or its authorization policy defined in its registration record prevents it from leveraging CAS functionality, or it's malformed and unrecognized by CAS. Contact your CAS administrator to learn how you might register and integrate your application with CAS.

Issue 2:
CAS is unable to process this request: "500:Internal Server Error"
There was an error trying to complete your request. Please notify your support desk or try again.
Apereo is a non-profit open source software governance foundation. The CAS software is an Apereo sponsored project and is freely downloadable and usable by anyone. However, Apereo does not operate the systems of anyone using the software and in most cases doesn't even know who is using it or how to contact them unless they are an active part of the Apereo community.

If you are having problems logging in using CAS, you will need to contact the IT staff or Help Desk of your organization for assistance.

We wish we could be more directly helpful to you.
Error: Exception thrown in state 'viewLoginForm' of flow 'login'what is the solution for this?


--
- Website: https://apereo.github.io/cas
- Gitter Chatroom: https://gitter.im/apereo/cas
- List Guidelines: https://goo.gl/1VRrw7
- Contributions: https://goo.gl/mh7qDG
---
You received this message because you are subscribed to the Google Groups "CAS Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cas-user+u...@apereo.org.
To view this discussion on the web visit https://groups.google.com/a/apereo.org/d/msgid/cas-user/afb305522e146152c0ef1346641b9ba6caeb867b.camel%40uvic.ca.
Reply all
Reply to author
Forward
0 new messages