env:
Java 8, CAS 5.1.3, Tomcat 8.5 (standalone), IntelliJ, macOS Sierra.

pom.xml:

<properties>
    <cas.version>5.1.3</cas.version>
</properties>

<dependencies>
    <dependency>
        <groupId>org.apereo.cas</groupId>
        <artifactId>cas-server-webapp</artifactId>
        <version>${cas.version}</version>
        <type>war</type>
        <scope>runtime</scope>
    </dependency>
    <dependency>
        <groupId>org.apereo.cas</groupId>
        <artifactId>cas-server-support-jdbc</artifactId>
        <version>${cas.version}</version>
    </dependency>
    <dependency>
        <groupId>org.apereo.cas</groupId>
        <artifactId>cas-server-support-json-service-registry</artifactId>
        <version>${cas.version}</version>
    </dependency>
    <dependency>
        <groupId>org.apereo.cas</groupId>
        <artifactId>cas-server-webapp-config-security</artifactId>
        <version>${cas.version}</version>
    </dependency>
    <dependency>
        <groupId>org.apereo.cas</groupId>
        <artifactId>cas-server-support-oauth-webflow</artifactId>
        <version>${cas.version}</version>
    </dependency>

    <dependency>
        <groupId>com.oracle</groupId>
        <artifactId>ojdbc8</artifactId>
        <version>12.2.0.1</version>
    </dependency>
</dependencies>


CAS runs fine at http://127.0.0.1:8080.

Registered a JSON service with CAS to act as a demo OAuth client:

{
  "@class": "org.apereo.cas.support.oauth.services.OAuthRegisteredService",
  "serviceId": "http://(127.0.0.1|localhost):8081/login/oauth2/cas",
  "clientId": "clientid",
  "clientSecret": "clientSecret",
  "name": "OAuth20ClientDemo",
  "id": 1002,
  "description": "",
  "evaluationOrder": 0,
  "attributeReleasePolicy": {
    "@class": "org.apereo.cas.services.ReturnAllAttributeReleasePolicy"
  }
}

When CAS starts, it automatically generate another JSON service (which 
seems a bit weird, however I cannot tell whether it is normal or not):

{
  @class: org.apereo.cas.services.RegexRegisteredService
  serviceId: http://localhost:8080/oauth2.0/callbackAuthorize.*
  name: RegexRegisteredService
  id: 103356745490349536
  description: OAuth Authentication Callback Request URL
  proxyPolicy:
  {
    @class: org.apereo.cas.services.RefuseRegisteredServiceProxyPolicy
  }
  evaluationOrder: 0
  usernameAttributeProvider:
  {
    @class: org.apereo.cas.services.DefaultRegisteredServiceUsernameProvider
    canonicalizationMode: NONE
    encryptUsername: false
  }
  attributeReleasePolicy:
  {
    @class: org.apereo.cas.services.DenyAllAttributeReleasePolicy
    principalAttributesRepository:
    {
      @class: 
org.apereo.cas.authentication.principal.DefaultPrincipalAttributesRepository
      expiration: 2
      timeUnit: HOURS
    }
    authorizedToReleaseCredentialPassword: false
    authorizedToReleaseProxyGrantingTicket: false
    excludeDefaultAttributes: true
  }
  multifactorPolicy:
  {
    @class: 
org.apereo.cas.services.DefaultRegisteredServiceMultifactorPolicy
    failureMode: CLOSED
    bypassEnabled: false
  }
  accessStrategy:
  {
    @class: org.apereo.cas.services.DefaultRegisteredServiceAccessStrategy
    enabled: true
    ssoEnabled: true
    requireAllAttributes: true
    caseInsensitive: false
  }
}

The demo client runs as another standalone Tomcat app at 
http://127.0.0.1:8081.

Now comes the testing process.

The first steps of the process look good:

http://localhost:8081/login/oauth2/cas
302 ->
http://127.0.0.1:8080/oauth2.0/authorize?client_id=clientid&redirect_uri=http://localhost:8081/login/oauth2/cas&response_type=code&state=2YqY0c
302 ->
http://localhost:8080/login?service=http%3A%2F%2Flocalhost%3A8080%2Foauth2.0%2FcallbackAuthorize%3Fclient_name%3DCasOAuthClient%26client_id%3Dclientid%26redirect_uri%3Dhttp%3A%2F%2Flocalhost%3A8081%2Flogin%2Foauth2%2Fcas

After inputing correct username/password in the form and press LOGIN, A 
POST is submitted to:
http://localhost:8080/login?service=http%3A%2F%2Flocalhost%3A8080%2Foauth2.0%2FcallbackAuthorize%3Fclient_name%3DCasOAuthClient%26client_id%3Dclientid%26redirect_uri%3Dhttp%3A%2F%2Flocalhost%3A8081%2Flogin%2Foauth2%2Fcas

The response is a 302 to the following url:

http://localhost:8080/oauth2.0/callbackAuthorize?client_name=CasOAuthClient&client_id=clientid&redirect_uri=http://localhost:8081/login/oauth2/cas&ticket=ST-6-T71F2TDPjCsPF9d3Shby-localhost

*Here comes the problem: The response of the above url (/callbackAuthorize) 
is a 302 redirection to '/' (root path of CAS), which then redirects to the 
login page (/login). *

I think the expected behavior of /callbackAuthorize should be a redirection 
back to the client app at http://localhost:8081/login/oauth2/cas with the 
OAuth token issued.

Did I get anything wrong or miss any configurations?

Thanks.


-- 
- 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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/a/apereo.org/d/msgid/cas-user/6cc6e864-c56a-4e96-96f6-557b63e33fb3%40apereo.org.

Reply via email to