Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

3.4.x [CAS-1146] CasDefaultFlowUrlHandler type mismatch with request.parameterMap #85

Closed
wants to merge 38 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
a343fc9
Remove superfluous directory
serac Sep 12, 2011
dd929aa
Merge markdown readme and POM changes from master
serac Sep 12, 2011
866fc59
Merge branch 'master' into 3.4.x
serac Sep 12, 2011
15a2fb1
Merge branch 'master' of github.com:serac/cas into 3.4.x
serac Oct 10, 2011
b751660
CAS-1052
battags Oct 9, 2011
4a79193
CAS-654
battags Oct 9, 2011
00ccafe
CAS-1055
battags Oct 9, 2011
fa9439c
Make it easier to override clone in subclasses
frett Oct 12, 2011
23a79e3
Update the supports method to support any implementation
frett Oct 12, 2011
06a01ef
Utilize the underlying createCommand method
frett Oct 12, 2011
1339395
messages for traditional chinese
Nov 8, 2011
0c9adbe
messages property file for traditional chinese
Nov 9, 2011
938bb6d
option for traditional chinese on loginView
Nov 9, 2011
321dca9
option for traditional chinese on loginView
Nov 9, 2011
11a2ca4
CAS-1077
Dec 7, 2011
5c08ece
CAS-1068
battags Dec 19, 2011
05b8450
CAS-1085
battags Jan 4, 2012
221cf00
CAS-1065 setting the responseComplete flag for response status 401
oehmiche Jan 27, 2012
870ac54
fixed jboss repository url, since the access has been denied
oehmiche Feb 10, 2012
497c498
CAS1086 - Added 2 new languages to CAS, Farsi and Arabic. Modified UI…
SavvasMisaghMoayyed Feb 10, 2012
a94452d
web.xml display name version number is now dynamic by using maven war…
dima767 Feb 23, 2012
902b168
CAS-1071
serac Mar 16, 2012
8c0538f
updated form controller to allow an explicit class to be set for all …
frett Mar 16, 2012
b3e5e41
test the RegisteredService form controller for regex support
frett Mar 16, 2012
ae7f96f
test support for arbitrary RegisteredService subclasses
frett Mar 16, 2012
4c007e2
added a @JoinColumn annotation to avoid a couple alter table queries
frett Mar 17, 2012
450415b
Be consistent with case in explicit table/column names in JPA annotat…
serac Mar 17, 2012
bb47204
adjust the default RegisteredService examples
frett Mar 19, 2012
454ca62
CAS-1071
serac Mar 19, 2012
d445261
CAS-1071
serac Mar 19, 2012
ac3b76d
CAS-1103: Changed screen.welcome.label.netid.accesskey from 'n' to 'u'
dima767 Mar 20, 2012
cba0b27
CAS-1074: Added management.services.service.warn to the French messag…
dima767 Mar 20, 2012
53ca446
Switch to https://github.com for valid SSL host.
serac Apr 16, 2012
224b016
[maven-release-plugin] prepare release v3.4.12-RC1
serac Apr 16, 2012
e27b3b4
[maven-release-plugin] prepare for next development iteration
serac Apr 16, 2012
6433506
[maven-release-plugin] prepare release v3.4.12
serac May 8, 2012
75dfb59
[maven-release-plugin] prepare for next development iteration
serac May 8, 2012
89e76c6
CAS-1146 CasDefaultFlowUrlHandler type mismatch with request.paramete…
cyrille-leclerc Jul 17, 2012
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion cas-server-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<artifactId>cas-server</artifactId>
<groupId>org.jasig.cas</groupId>
<version>3.4.11-SNAPSHOT</version>
<version>3.4.13-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.jasig.cas</groupId>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,253 @@
/*
* Copyright 2012 The JA-SIG Collaborative. All rights reserved. See license
* distributed with this file and available online at http://www.jasig.org/cas/license.
*/

package org.jasig.cas.services;

import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;
import org.hibernate.annotations.IndexColumn;

import javax.persistence.*;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

/**
* Base class for mutable, persistable registered services.
*
* @author Marvin S. Addison
* @author Scott Battaglia
*/
@Entity
@Inheritance
@DiscriminatorColumn(
name = "expression_type",
length = 15,
discriminatorType = DiscriminatorType.STRING,
columnDefinition = "VARCHAR(15) DEFAULT 'ant'")
@Table(name = "RegisteredServiceImpl")
public abstract class AbstractRegisteredService
implements RegisteredService, Comparable<RegisteredService>, Serializable {

/** Serialization version marker */
private static final long serialVersionUID = 7645279151115635245L;

@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private long id = -1;

@ElementCollection(targetClass = String.class, fetch = FetchType.EAGER)
@JoinTable(name = "rs_attributes", joinColumns = @JoinColumn(name = "RegisteredServiceImpl_id"))
@Column(name = "a_name", nullable = false)
@IndexColumn(name = "a_id")
private List<String> allowedAttributes = new ArrayList<String>();

private String description;

protected String serviceId;

private String name;

private String theme;

private boolean allowedToProxy = true;

private boolean enabled = true;

private boolean ssoEnabled = true;

private boolean anonymousAccess = false;

private boolean ignoreAttributes = false;

@Column(name = "evaluation_order", nullable = false)
private int evaluationOrder;


public boolean isAnonymousAccess() {
return this.anonymousAccess;
}

public void setAnonymousAccess(final boolean anonymousAccess) {
this.anonymousAccess = anonymousAccess;
}

public List<String> getAllowedAttributes() {
return this.allowedAttributes;
}

public long getId() {
return this.id;
}

public String getDescription() {
return this.description;
}

public String getServiceId() {
return this.serviceId;
}

public String getName() {
return this.name;
}

public String getTheme() {
return this.theme;
}

public boolean isAllowedToProxy() {
return this.allowedToProxy;
}

public boolean isEnabled() {
return this.enabled;
}

public boolean isSsoEnabled() {
return this.ssoEnabled;
}

@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof AbstractRegisteredService)) return false;

final AbstractRegisteredService that = (AbstractRegisteredService) o;

if (allowedToProxy != that.allowedToProxy) return false;
if (anonymousAccess != that.anonymousAccess) return false;
if (enabled != that.enabled) return false;
if (evaluationOrder != that.evaluationOrder) return false;
if (ignoreAttributes != that.ignoreAttributes) return false;
if (ssoEnabled != that.ssoEnabled) return false;
if (allowedAttributes != null ? !allowedAttributes.equals(that.allowedAttributes) : that.allowedAttributes != null)
return false;
if (description != null ? !description.equals(that.description) : that.description != null) return false;
if (name != null ? !name.equals(that.name) : that.name != null) return false;
if (serviceId != null ? !serviceId.equals(that.serviceId) : that.serviceId != null) return false;
if (theme != null ? !theme.equals(that.theme) : that.theme != null) return false;

return true;
}

@Override
public int hashCode() {
int result = allowedAttributes != null ? allowedAttributes.hashCode() : 0;
result = 31 * result + (description != null ? description.hashCode() : 0);
result = 31 * result + (serviceId != null ? serviceId.hashCode() : 0);
result = 31 * result + (name != null ? name.hashCode() : 0);
result = 31 * result + (theme != null ? theme.hashCode() : 0);
result = 31 * result + (allowedToProxy ? 1 : 0);
result = 31 * result + (enabled ? 1 : 0);
result = 31 * result + (ssoEnabled ? 1 : 0);
result = 31 * result + (anonymousAccess ? 1 : 0);
result = 31 * result + (ignoreAttributes ? 1 : 0);
result = 31 * result + evaluationOrder;
return result;
}

public void setAllowedAttributes(final List<String> allowedAttributes) {
if (allowedAttributes == null) {
this.allowedAttributes = new ArrayList<String>();
} else {
this.allowedAttributes = allowedAttributes;
}
}

public void setAllowedToProxy(final boolean allowedToProxy) {
this.allowedToProxy = allowedToProxy;
}

public void setDescription(final String description) {
this.description = description;
}

public void setEnabled(final boolean enabled) {
this.enabled = enabled;
}

public abstract void setServiceId(final String id);

public void setId(final long id) {
this.id = id;
}

public void setName(final String name) {
this.name = name;
}

public void setSsoEnabled(final boolean ssoEnabled) {
this.ssoEnabled = ssoEnabled;
}

public void setTheme(final String theme) {
this.theme = theme;
}

public boolean isIgnoreAttributes() {
return this.ignoreAttributes;
}

public void setIgnoreAttributes(final boolean ignoreAttributes) {
this.ignoreAttributes = ignoreAttributes;
}

public void setEvaluationOrder(final int evaluationOrder) {
this.evaluationOrder = evaluationOrder;
}

public int getEvaluationOrder() {
return this.evaluationOrder;
}

public Object clone() throws CloneNotSupportedException {
final AbstractRegisteredService clone = newInstance();
clone.copyFrom(this);
return clone;
}

/**
* Copies the properties of the source service into this instance.
*
* @param source Source service from which to copy properties.
*/
public void copyFrom(final RegisteredService source) {
this.setId(source.getId());
this.setAllowedAttributes(new ArrayList<String>(source.getAllowedAttributes()));
this.setAllowedToProxy(source.isAllowedToProxy());
this.setDescription(source.getDescription());
this.setEnabled(source.isEnabled());
this.setName(source.getName());
this.setServiceId(source.getServiceId());
this.setSsoEnabled(source.isSsoEnabled());
this.setTheme(source.getTheme());
this.setAnonymousAccess(source.isAnonymousAccess());
this.setIgnoreAttributes(source.isIgnoreAttributes());
this.setEvaluationOrder(source.getEvaluationOrder());
}

public int compareTo(final RegisteredService other) {
final int result = this.evaluationOrder - other.getEvaluationOrder();
if (result == 0) {
return (int) (this.id - other.getId());
}
return result;
}

@Override
public String toString() {
final ToStringBuilder toStringBuilder = new ToStringBuilder(null, ToStringStyle.SHORT_PREFIX_STYLE);
toStringBuilder.append("id", this.id);
toStringBuilder.append("name", this.name);
toStringBuilder.append("description", this.description);
toStringBuilder.append("serviceId", this.serviceId);
toStringBuilder.append("attributes", this.allowedAttributes.toArray());

return toStringBuilder.toString();
}

protected abstract AbstractRegisteredService newInstance();
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,10 @@
*/
package org.jasig.cas.services;

import javax.validation.constraints.NotNull;
import java.util.ArrayList;
import java.util.List;

import org.jasig.cas.util.DefaultLongNumericGenerator;
import org.jasig.cas.util.LongNumericGenerator;

import javax.validation.constraints.NotNull;

/**
* Default In Memory Service Registry Dao for test/demonstration purposes.
*
Expand Down Expand Up @@ -46,7 +42,7 @@ public List<RegisteredService> load() {

public RegisteredService save(final RegisteredService registeredService) {
if (registeredService.getId() == -1) {
((RegisteredServiceImpl) registeredService).setId(findHighestId()+1);
((AbstractRegisteredService) registeredService).setId(findHighestId()+1);
}

this.registeredServices.remove(registeredService);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
*/
package org.jasig.cas.services;

import java.util.List;

import org.springframework.orm.jpa.support.JpaDaoSupport;

import java.util.List;

/**
* Implementation of the ServiceRegistryDao based on JPA.
*
Expand All @@ -27,7 +27,7 @@ public boolean delete(final RegisteredService registeredService) {
}

public List<RegisteredService> load() {
return getJpaTemplate().find("select r from RegisteredServiceImpl r");
return getJpaTemplate().find("select r from AbstractRegisteredService r");
}

public RegisteredService save(final RegisteredService registeredService) {
Expand All @@ -43,6 +43,6 @@ public RegisteredService save(final RegisteredService registeredService) {
}

public RegisteredService findServiceById(final long id) {
return getJpaTemplate().find(RegisteredServiceImpl.class, id);
return getJpaTemplate().find(AbstractRegisteredService.class, id);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/*
* Copyright 2012 The JA-SIG Collaborative. All rights reserved. See license
* distributed with this file and available online at
* http://www.jasig.org/cas/license.
*/
package org.jasig.cas.services;

import org.jasig.cas.authentication.principal.Service;

import javax.persistence.DiscriminatorValue;
import javax.persistence.Entity;
import java.util.regex.Pattern;

/**
* Mutable registered service that uses Java regular expressions for service matching.
*
* @author Marvin S. Addison
* @version $Revision: $
*/
@Entity
@DiscriminatorValue("regex")
public class RegexRegisteredService extends AbstractRegisteredService {
/** Serialization version marker */
private static final long serialVersionUID = -8258660210826975771L;

private transient Pattern servicePattern;

public void setServiceId(final String id) {
servicePattern = createPattern(id);
serviceId = id;
}

public boolean matches(final Service service) {
if (servicePattern == null) {
servicePattern = createPattern(serviceId);
}
return service != null && servicePattern.matcher(service.getId()).matches();
}

protected AbstractRegisteredService newInstance() {
return new RegexRegisteredService();
}

private Pattern createPattern(final String pattern) {
if (pattern == null) {
throw new IllegalArgumentException("Pattern cannot be null.");
}
return Pattern.compile(pattern);
}
}