Start with external configuration in CAS 6.1.x

58 views
Skip to first unread message

Robert Witkowski

unread,
Jul 23, 2019, 10:30:46 AM7/23/19
to CAS Community
Hi,
I want to extend OAuth Configuration like this:

I created classes in WAR Overlay (clone from https://github.com/apereo/cas-overlay-template branch master):
package com.example.cas.custom;

import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

@Configuration("MyOAuthConfiguration")
@EnableConfigurationProperties(CasConfigurationProperties.class)
public class MyOAuthConfiguration {

    @Bean
    @RefreshScope
    public OAuth20UserProfileViewRenderer oauthUserProfileViewRenderer() {
        return new CustomOAuthRenderer();
    }

    public class CustomOAuthRenderer implements OAuth20UserProfileViewRenderer {

        @Override
        public String render(Map<String, Object> model, AccessToken accessToken) {
            return model.toString();
        }
    }
}


But I can't compile this code, because Gradle/IntelliJ cannot find dependencies:

import org.apereo.cas.configuration.CasConfigurationProperties;
import org.apereo.cas.support.oauth.web.views.OAuth20UserProfileViewRenderer;
import org.apereo.cas.ticket.accesstoken.AccessToken;

I added missing dependencies manually (but I can't find info about this in documentation):

compile "org.apereo.cas:cas-core-api-configuration-model:${project.'cas.version'}"
compile "org.apereo.cas:cas-server-support-oauth:${project.'cas.version'}"
compile "org.apereo.cas:cas-server-support-oauth-api:${project.'cas.version'}"

cas.version=6.1.0-RC5-SNAPSHOT

Gradle cannot find dependencies:
Execution failed for task ':compileJava'.
> Could not resolve all files for configuration ':compileClasspath'.
   > Could not find org.apereo.cas:cas-core-api-configuration-model:6.1.0-RC5-SNAPSHOT.

Gradle found dependencies from old version (6.0.4) but it is not compatible:
{
  "errors": [
    {
      "status": 409,
      "message": "The repository 'oss-snapshot-local' rejected the resolution of an artifact 'oss-snapshot-local:org/apereo/cas/cas-core-api-configuration-model/6.0.4/cas-core-api-configuration-model-6.0.4.pom' due to conflict in the snapshot release handling policy."
    }
  ]
}

What am I doing wrong?


Andy Ng

unread,
Jul 23, 2019, 11:14:15 PM7/23/19
to CAS Community
Hi,

Do you want to import this instead: https://mvnrepository.com/artifact/org.apereo.cas/cas-server-core-api-configuration-model 

I don't find any module named `cas:cas-core-api-configuration-model` which is why this failed.

- Andy 

Andy Ng

unread,
Jul 23, 2019, 11:14:41 PM7/23/19
to CAS Community
which is why this failed => which might be why this failed - Andy

first_step_with_CAS

unread,
Jul 24, 2019, 5:33:35 AM7/24/19
to CAS Community
I can't find version of this artifact for 6.1.0-RC5
Reply all
Reply to author
Forward
0 new messages