Skip to content

Commit

Permalink
Merge branch 'master' into Mfa
Browse files Browse the repository at this point in the history
# Conflicts:
#	build.gradle
#	cas-server-core-web/src/main/java/org/jasig/cas/web/support/WebUtils.java
#	cas-server-documentation/installation/Configuring-Multifactor-Authentication.md
#	cas-server-documentation/installation/RADIUS-Authentication.md
#	cas-server-documentation/installation/Service-Management.md
#	cas-server-documentation/installation/YubiKey-Authentication.md
#	cas-server-support-oauth/src/main/resources/META-INF/spring/cas-servlet-oauth.xml
#	cas-server-support-wsfederation-webflow/src/main/java/org/jasig/cas/web/flow/WsFederationWebflowConfigurer.java
  • Loading branch information
SavvasMisaghMoayyed committed Feb 5, 2016
2 parents 7b45c57 + aa0ac5b commit 3727d69
Show file tree
Hide file tree
Showing 335 changed files with 5,193 additions and 3,909 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
argfile*
.classpath
!/.project
.project
Expand Down
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ branches:
only:
- master
jdk:
# - oraclejdk7
- oraclejdk8
cache:
directories:
Expand Down
42 changes: 28 additions & 14 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ ext.libraries = [
},
cassecurityfilter: "org.jasig.cas:cas-server-security-filter:$casSecurityFilterVersion",
commons : [
"commons-codec:commons-codec:$commonsCodecVersion",
"commons-io:commons-io:$commonsIoVersion",
"commons-codec:commons-codec:$commonsCodecVersion",
dependencies.create("commons-jexl:commons-jexl:$commonsJexlVersion") {
exclude(group: 'commons-logging', module: 'commons-logging')
exclude(group: 'junit', module: 'junit')
Expand Down Expand Up @@ -109,10 +109,13 @@ ext.libraries = [
},
"com.mchange:c3p0:$c3p0Version"
],
httpclient : dependencies.create("org.apache.httpcomponents:httpclient:$httpclientVersion") {
exclude(group: 'commons-codec', module: 'commons-codec')
force = true
},
httpclient : [
dependencies.create("org.apache.httpcomponents:httpclient:$httpclientVersion") {
exclude(module: 'commons-codec')
force = true
},
"commons-codec:commons-codec:$commonsCodecVersion"
],
shibidp : [
dependencies.create("net.shibboleth.idp:idp-attribute-filter-api:$idpVersion") {
exclude(group: 'com.google.guava', module: 'guava')
Expand Down Expand Up @@ -257,14 +260,16 @@ ext.libraries = [
exclude(group: 'org.springframework', module: 'spring-context-support')
exclude(group: 'org.apache.httpcomponents', module: 'httpclient')
exclude(group: 'org.apache.httpcomponents', module: 'httpclient-cache')
exclude(group: 'commons-codec', module: 'commons-codec')
exclude(group: 'org.springframework.webflow', module: 'spring-webflow')
exclude(group: 'org.springframework', module: 'spring-expression')
exclude(group: 'org.bouncycastle', module: 'bcprov-jdk15on')
exclude(group: 'org.ldaptive', module: 'ldaptive')
exclude(group: 'ch.qos.logback', module: 'logback-core')
exclude(group: 'ch.qos.logback', module: 'logback-classic')
force = true
}
},
"commons-codec:commons-codec:$commonsCodecVersion"
],
ignite : [
"org.apache.ignite:ignite-core:$igniteVersion",
Expand Down Expand Up @@ -496,6 +501,7 @@ ext.libraries = [
exclude(group: 'org.springframework', module: 'spring-beans')
exclude(group: 'org.springframework', module: 'spring-core')
exclude(group: 'org.apache.httpcomponents', module: 'httpclient')
exclude(group: 'commons-codec', module: 'commons-codec')
exclude(group: 'com.google.guava', module: 'guava')
force = true
},
Expand Down Expand Up @@ -548,7 +554,8 @@ ext.libraries = [
exclude(group: 'org.apache.httpcomponents', module: 'httpclient')
exclude(group: 'com.google.guava', module: 'guava')
force = true
}
},
"commons-codec:commons-codec:$commonsCodecVersion"
],
pac4j : [
dependencies.create("org.pac4j:pac4j-cas:$pac4jVersion") {
Expand Down Expand Up @@ -595,6 +602,7 @@ ext.libraries = [
dependencies.create("org.pac4j:pac4j-core:$pac4jVersion") {
exclude(group: 'org.slf4j', module: 'slf4j-api')
exclude(group: 'joda-time', module: 'joda-time')
exclude(group: 'commons-codec', module: 'commons-codec')
force = true
},
dependencies.create("org.pac4j:pac4j-http:$pac4jVersion") {
Expand Down Expand Up @@ -627,6 +635,7 @@ ext.libraries = [
},
dependencies.create("org.pac4j:pac4j-oauth:$pac4jVersion") {
exclude(group: 'org.apache.commons', module: 'commons-lang3')
exclude(group: 'org.apache.commons', module: 'commons-codec')
exclude(group: 'org.slf4j', module: 'slf4j-api')
exclude(group: 'org.slf4j', module: 'jcl-over-slf4j')
exclude(group: 'joda-time', module: 'joda-time')
Expand Down Expand Up @@ -683,8 +692,8 @@ ext.libraries = [
exclude(group: 'joda-time', module: 'joda-time')
exclude(group: 'org.slf4j', module: 'jcl-over-slf4j')
force = true
}

},
"commons-codec:commons-codec:$commonsCodecVersion",
],
persondirectory : dependencies.create("org.jasig.service.persondir:person-directory-impl:$personDirectoryVersion") {
exclude(group: 'commons-logging', module: 'commons-logging')
Expand Down Expand Up @@ -769,14 +778,16 @@ ext.libraries = [
exclude(group: 'org.bouncycastle', module: 'bcprov-jdk15on')
force = true
},
"commons-codec:commons-codec:$commonsCodecVersion",
"org.springframework:spring-webmvc:$springVersion"
],
validationapi : "javax.validation:validation-api:$javaxValidationVersion",
xmlapis : "xml-apis:xml-apis:$xmlapisVersion",
yubicoapi : dependencies.create("com.yubico:yubico-validation-client2:$yubicoVersion") {
exclude(group: 'org.slf4j', module: 'slf4j-api')
exclude(group: 'commons-codec', module: 'commons-codec')
force = true
yubicoapi : [
dependencies.create("com.yubico:yubico-validation-client2:$yubicoVersion") {
exclude(group: 'org.slf4j', module: 'slf4j-api')
exclude(group: 'commons-codec', module: 'commons-codec')
force = true
},
duojava : [
dependencies.create("net.unicon.iam:duo-java:$duoVersion") {
Expand Down Expand Up @@ -828,6 +839,9 @@ allprojects {
}

subprojects {
task allDepInsight(type: DependencyInsightReportTask) << {}
task allDeps(type: DependencyReportTask) {}

apply plugin: 'java'
apply plugin: 'checkstyle'
apply plugin: 'findbugs'
Expand Down Expand Up @@ -910,7 +924,7 @@ subprojects {
attributes("Implementation-Title": project.name,
"Implementation-Vendor": project.group,
"Created-By": project.group,
"Implementation-Date": new Date(),
"Implementation-Date": java.time.ZonedDateTime.now(),
"Implementation-Version": project.version)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

/**
* MultiActionController to handle the deletion of RegisteredServices as well as
Expand Down Expand Up @@ -158,9 +159,7 @@ public void getServices(final HttpServletResponse response) {
final Map<String, Object> model = new HashMap<>();
final List<RegisteredServiceViewBean> serviceBeans = new ArrayList<>();
final List<RegisteredService> services = new ArrayList<>(this.servicesManager.getAllServices());
for (final RegisteredService svc : services) {
serviceBeans.add(registeredServiceFactory.createServiceViewBean(svc));
}
serviceBeans.addAll(services.stream().map(registeredServiceFactory::createServiceViewBean).collect(Collectors.toList()));
model.put("services", serviceBeans);
model.put("status", HttpServletResponse.SC_OK);
JsonViewUtils.render(model, response);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ public RegisteredServiceAttributeReleasePolicy toAttributeReleasePolicy(final Se
final RegisteredServiceAttributeReleasePolicyStrategyEditBean policyBean = attrRelease.getAttrPolicy();
final String policyType = policyBean.getType();

AbstractRegisteredServiceAttributeReleasePolicy policy;
final AbstractRegisteredServiceAttributeReleasePolicy policy;
if (StringUtils.equalsIgnoreCase(policyType, AbstractRegisteredServiceAttributeReleasePolicyStrategyBean
.Types.ALL.toString())) {
policy = new ReturnAllAttributeReleasePolicy();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public void setUsernameAttributeProviderMapper(
this.usernameAttributeProviderMapper = usernameAttributeProviderMapper;
}

public void setFormDataPopulators(final List<? extends FormDataPopulator> formDataPopulators) {
public void setFormDataPopulators(@NotNull final List<? extends FormDataPopulator> formDataPopulators) {
this.formDataPopulators = formDataPopulators;
}

Expand Down Expand Up @@ -145,11 +145,7 @@ public void initializeDefaults() {
@Override
public FormData createFormData() {
final FormData data = new FormData();
if (formDataPopulators != null) {
for (final FormDataPopulator populator : formDataPopulators) {
populator.populateFormData(data);
}
}
formDataPopulators.stream().forEach(populator -> populator.populateFormData(data));
return data;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import org.jasig.cas.services.web.beans.RegisteredServicePublicKeyEditBean;
import org.jasig.cas.services.web.beans.RegisteredServiceTypeEditBean;
import org.jasig.cas.services.web.beans.RegisteredServiceViewBean;
import org.jasig.cas.support.oauth.services.OAuthRegisteredCallbackAuthorizeService;
import org.jasig.cas.support.oauth.services.OAuthCallbackAuthorizeService;
import org.jasig.cas.support.oauth.services.OAuthRegisteredService;
import org.slf4j.Logger;
import org.springframework.stereotype.Component;
Expand Down Expand Up @@ -52,7 +52,7 @@ public void mapRegisteredService(final RegisteredService svc, final ServiceData
}
bean.setRequiredHandlers(svc.getRequiredHandlers());

if (svc instanceof OAuthRegisteredCallbackAuthorizeService) {
if (svc instanceof OAuthCallbackAuthorizeService) {
bean.setType(RegisteredServiceTypeEditBean.OAUTH_CALLBACK_AUTHZ.toString());
}

Expand Down Expand Up @@ -113,7 +113,7 @@ public RegisteredService toRegisteredService(final ServiceData data) {
// create base RegisteredService object
final String type = data.getType();
if (StringUtils.equalsIgnoreCase(type, RegisteredServiceTypeEditBean.OAUTH_CALLBACK_AUTHZ.toString())) {
regSvc = new OAuthRegisteredCallbackAuthorizeService();
regSvc = new OAuthCallbackAuthorizeService();
} else if (StringUtils.equalsIgnoreCase(type, RegisteredServiceTypeEditBean.OAUTH.toString())) {
regSvc = new OAuthRegisteredService();

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package org.jasig.cas.services.web;

import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import org.jasig.cas.services.AbstractRegisteredService;
import org.jasig.cas.services.DefaultServicesManagerImpl;
import org.jasig.cas.services.InMemoryServiceRegistryDaoImpl;
Expand All @@ -15,6 +13,9 @@
import org.jasig.cas.services.web.factory.DefaultRegisteredServiceMapper;
import org.jasig.cas.services.web.factory.RegisteredServiceMapper;
import org.jasig.services.persondir.support.StubPersonAttributeDao;

import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
Expand Down Expand Up @@ -200,12 +201,9 @@ public void verifyAddMockRegisteredService() throws Exception {

final Collection<RegisteredService> services = this.manager.getAllServices();
assertEquals(1, services.size());
for (final RegisteredService rs : this.manager.getAllServices()) {
assertTrue(rs instanceof MockRegisteredService);
}
this.manager.getAllServices().stream().forEach(rs -> assertTrue(rs instanceof MockRegisteredService));
}


@Test
public void verifyEditMockRegisteredService() throws Exception {
registeredServiceFactory.setRegisteredServiceMapper(new MockRegisteredServiceMapper());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,4 @@
<bean id="credentialsValidator" class="org.springframework.validation.beanvalidation.LocalValidatorFactoryBean"
p:messageInterpolator-ref="messageInterpolator"/>

<!-- just to make the management webapp work as it's not really used -->
<bean id="accessTokenJwtGenerator" class="org.pac4j.jwt.profile.JwtGenerator">
<constructor-arg name="signingSecret" value="12345678901234567890123456789012" />
<constructor-arg name="encryptionSecret" value="12345678901234567890123456789012" />
</bean>

<bean id="accessTokenJwtAuthenticator" class="org.pac4j.jwt.credentials.authenticator.JwtAuthenticator">
<constructor-arg name="signingSecret" value="12345678901234567890123456789012" />
<constructor-arg name="encryptionSecret" value="12345678901234567890123456789012" />
</bean>

</beans>
5 changes: 3 additions & 2 deletions cas-management-webapp/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ war {
attributes("Implementation-Title": project.name,
"Implementation-Vendor": project.group,
"Created-By": project.group,
"Implementation-Date": new Date(),
"Implementation-Date": java.time.ZonedDateTime.now(),
"Implementation-Version": project.version)
}
}
Expand All @@ -29,7 +29,8 @@ dependencies {
}

gretty {
jvmArgs = ["-Dorg.eclipse.jetty.annotations.maxWait=120","-Xdebug","-Xrunjdwp:transport=dt_socket,address=5000,server=y,suspend=n"]
jvmArgs = ["-DloggerFactory=\"org.apache.logging.slf4j.Log4jLoggerFactory\"", "-Dorg.eclipse.jetty.annotations.maxWait=120","-Xdebug",
"-Xrunjdwp:transport=dt_socket,address=5000,server=y,suspend=n"]
scanInterval = 5
contextPath = '/cas-management'
httpsEnabled = project.ext.jettySslConfigEnabled
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package org.jasig.cas.authentication;

import org.jasig.cas.authentication.principal.Principal;
import org.joda.time.DateTime;

import java.io.Serializable;
import java.time.ZonedDateTime;
import java.util.List;
import java.util.Map;

Expand Down Expand Up @@ -43,7 +43,7 @@ public interface Authentication extends Serializable {
*
* @return the date/time the authentication occurred.
*/
DateTime getAuthenticationDate();
ZonedDateTime getAuthenticationDate();

/**
* Attributes of the authentication (not the Principal).
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package org.jasig.cas.authentication;

import org.jasig.cas.authentication.principal.Principal;
import org.joda.time.DateTime;

import java.io.Serializable;
import java.util.List;
import java.time.ZonedDateTime;
import java.util.Map;

/**
Expand Down Expand Up @@ -113,7 +113,7 @@ public interface AuthenticationBuilder extends Serializable {
* @param d Authentication date.
* @return This builder instance.
*/
AuthenticationBuilder setAuthenticationDate(DateTime d);
AuthenticationBuilder setAuthenticationDate(ZonedDateTime d);

/**
* Creates an immutable authentication instance from builder data.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,23 @@ public class AuthenticationException extends Exception {

/**
* Creates a new instance for the case when no handlers were attempted, i.e. no successes or failures.
*
* @param msg the msg
*/
public AuthenticationException() {
public AuthenticationException(final String msg) {
this(
"No supported authentication handlers found for given credentials.",
msg,
Collections.<String, Class<? extends Exception>>emptyMap(),
Collections.<String, HandlerResult>emptyMap());
}

/**
* Instantiates a new Authentication exception.
*/
public AuthenticationException() {
this("No supported authentication handlers found for given credentials.");
}

/**
* Creates a new instance for the case when no handlers succeeded.
*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package org.jasig.cas.services;

import com.google.common.base.Predicate;
import org.jasig.cas.authentication.principal.Service;

import com.google.common.base.Predicate;

import java.util.Collection;

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.jasig.cas.ticket;

import java.io.Serializable;
import java.time.ZonedDateTime;

/**
* Interface for the generic concept of a ticket.
Expand Down Expand Up @@ -39,7 +40,7 @@ public interface Ticket extends Serializable {
*
* @return the time the ticket was created.
*/
long getCreationTime();
ZonedDateTime getCreationTime();

/**
* @return the number of times this ticket was used.
Expand Down
Loading

0 comments on commit 3727d69

Please sign in to comment.