Skip to content

Commit

Permalink
CAS-1286: Extract the OAuth client support in its own module and upgr…
Browse files Browse the repository at this point in the history
…ade to pac4j

Merge with master
  • Loading branch information
leleuj committed Apr 7, 2013
2 parents 9782694 + 21fb985 commit 9d27642
Show file tree
Hide file tree
Showing 588 changed files with 7,736 additions and 7,389 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,5 @@ bin/
overlays/
pom.xml.versionsBackup
*.log

**/.checkstyle
26 changes: 13 additions & 13 deletions NOTICE
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ This project includes:
ASM Core under BSD
AspectJ runtime under Eclipse Public License - v 1.0
AspectJ weaver under Eclipse Public License - v 1.0
Backport of JSR 166 under Public Domain
Bean Validation API under Apache License, Version 2.0
Bouncy Castle Provider under Bouncy Castle Licence
Central Authentication Service under Jasig License
Expand All @@ -47,6 +46,7 @@ This project includes:
commons-collections under Apache License, Version 2.0
Digester under The Apache Software License, Version 2.0
dom4j under BSD License
ehcache under The Apache Software License, Version 2.0
Ehcache Core under The Apache Software License, Version 2.0
ESAPI 2.0 under BSD or Creative Commons 3.0 BY-SA
ezmorph under The Apache Software License, Version 2.0
Expand Down Expand Up @@ -110,7 +110,6 @@ This project includes:
jradius-dictionary-1.0.0 under GNU Lessor/Library Public License, Version 3.0 or GNU Public License, Version 3.0
json-lib under Apache License, Version 2.0
JSR 105 - Java(TM) XML Digital Signature API under JDL license
jsr107cache under Apache License, Version 2.0
jstl under Commons Development and Distribution License, Version 1.0
JUL to SLF4J bridge under MIT License
JUnit under Common Public License Version 1.0
Expand Down Expand Up @@ -142,30 +141,31 @@ This project includes:
SLF4J API Module under MIT License
SLF4J LOG4J-12 Binding under MIT License
SOJO under The Apache Software License, Version 2.0
Spring AOP under The Apache Software License, Version 2.0
Spring Beans under The Apache Software License, Version 2.0
Spring Binding under Apache License, Version 2.0
Spring Context under The Apache Software License, Version 2.0
Spring Context Support under The Apache Software License, Version 2.0
Spring Core under The Apache Software License, Version 2.0
Spring Expression Language (SpEL) under The Apache Software License, Version 2.0
Spring JavaScript under Apache License, Version 2.0
Spring JavaScript Resources under Apache License, Version 2.0
Spring JDBC under The Apache Software License, Version 2.0
Spring Json View under The Apache Software License, Version 2.0
Spring LDAP Core under Apache License, Version 2.0
Spring LDAP Java 5 support under Apache License, Version 2.0
Spring Object/Relational Mapping under The Apache Software License, Version 2.0
Spring TestContext Framework under The Apache Software License, Version 2.0
Spring Transaction under The Apache Software License, Version 2.0
Spring Web under The Apache Software License, Version 2.0
Spring Web Flow under Apache License, Version 2.0
spring-aop under The Apache Software License, Version 2.0
Spring Web MVC under The Apache Software License, Version 2.0
spring-asm under Apache License, Version 2.0
spring-beans under The Apache Software License, Version 2.0
spring-context under The Apache Software License, Version 2.0
spring-context-support under The Apache Software License, Version 2.0
spring-core under The Apache Software License, Version 2.0
spring-expression under Apache License, Version 2.0
spring-jdbc under The Apache Software License, Version 2.0
spring-orm under The Apache Software License, Version 2.0
spring-security-cas under The Apache Software License, Version 2.0
spring-security-config under The Apache Software License, Version 2.0
spring-security-core under The Apache Software License, Version 2.0
spring-security-web under The Apache Software License, Version 2.0
spring-test under The Apache Software License, Version 2.0
spring-tx under The Apache Software License, Version 2.0
spring-web under The Apache Software License, Version 2.0
spring-webmvc under The Apache Software License, Version 2.0
spymemcached under The MIT License
standard under Apache License, Version 2.0
StAX API under The Apache Software License, Version 2.0
Expand Down
25 changes: 12 additions & 13 deletions cas-management-webapp/NOTICE
Original file line number Diff line number Diff line change
Expand Up @@ -65,24 +65,23 @@ This project includes:
SLF4J API Module under MIT License
SLF4J LOG4J-12 Binding under MIT License
SOJO under The Apache Software License, Version 2.0
Spring AOP under The Apache Software License, Version 2.0
Spring Beans under The Apache Software License, Version 2.0
Spring Context under The Apache Software License, Version 2.0
Spring Context Support under The Apache Software License, Version 2.0
Spring Core under The Apache Software License, Version 2.0
Spring Expression Language (SpEL) under The Apache Software License, Version 2.0
Spring JDBC under The Apache Software License, Version 2.0
Spring Json View under The Apache Software License, Version 2.0
spring-aop under The Apache Software License, Version 2.0
spring-asm under The Apache Software License, Version 2.0
spring-beans under The Apache Software License, Version 2.0
spring-context under The Apache Software License, Version 2.0
spring-context-support under The Apache Software License, Version 2.0
spring-core under The Apache Software License, Version 2.0
spring-expression under The Apache Software License, Version 2.0
spring-jdbc under The Apache Software License, Version 2.0
spring-orm under The Apache Software License, Version 2.0
Spring Object/Relational Mapping under The Apache Software License, Version 2.0
Spring TestContext Framework under The Apache Software License, Version 2.0
Spring Transaction under The Apache Software License, Version 2.0
Spring Web under The Apache Software License, Version 2.0
Spring Web MVC under The Apache Software License, Version 2.0
spring-security-cas under The Apache Software License, Version 2.0
spring-security-config under The Apache Software License, Version 2.0
spring-security-core under The Apache Software License, Version 2.0
spring-security-web under The Apache Software License, Version 2.0
spring-test under The Apache Software License, Version 2.0
spring-tx under The Apache Software License, Version 2.0
spring-web under The Apache Software License, Version 2.0
spring-webmvc under The Apache Software License, Version 2.0
standard under Apache License, Version 2.0
StAX API under The Apache Software License, Version 2.0
Streaming API for XML under Sun Binary Code License
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,8 @@
/**
* MultiActionController to handle the deletion of RegisteredServices as well as
* displaying them on the Manage Services page.
*
*
* @author Scott Battaglia
* @version $Revision$ $Date$
* @since 3.1
*/
public final class ManageRegisteredServicesMultiActionController extends MultiActionController {
Expand All @@ -52,57 +51,55 @@ public final class ManageRegisteredServicesMultiActionController extends MultiAc

@NotNull
private final String defaultServiceUrl;

/**
* Constructor that takes the required {@link ServicesManager}.
*
*
* @param servicesManager the Services Manager that manages the
* RegisteredServices.
* @param defaultServiceUrl the service management tool's url.
*/
public ManageRegisteredServicesMultiActionController(
final ServicesManager servicesManager, final String defaultServiceUrl) {
final ServicesManager servicesManager, final String defaultServiceUrl) {
super();
this.servicesManager = servicesManager;
this.defaultServiceUrl = defaultServiceUrl;
}

/**
* Method to delete the RegisteredService by its ID.
*
* @param request the HttpServletRequest
* @param response the HttpServletResponse
* @return the Model and View to go to after the service is deleted.
*/
public ModelAndView deleteRegisteredService(
final HttpServletRequest request, final HttpServletResponse response) {
final HttpServletRequest request, final HttpServletResponse response) {
final String id = request.getParameter("id");
final long idAsLong = Long.parseLong(id);

final ModelAndView modelAndView = new ModelAndView(new RedirectView(
"manage.html", true), "status", "deleted");
"manage.html", true), "status", "deleted");

final RegisteredService r = this.servicesManager.delete(idAsLong);

modelAndView.addObject("serviceName", r != null
? r.getName() : "");
? r.getName() : "");

return modelAndView;
}

/**
* Method to show the RegisteredServices.
*
* @param request the HttpServletRequest
* @param response the HttpServletResponse
* @return the Model and View to go to after the services are loaded.
*/
public ModelAndView manage(final HttpServletRequest request,
final HttpServletResponse response) {
final HttpServletResponse response) {
final Map<String, Object> model = new HashMap<String, Object>();

final List<RegisteredService> services = new ArrayList<RegisteredService>(this.servicesManager.getAllServices());

model.put("services", services);
model.put("pageTitle", VIEW_NAME);
model.put("defaultServiceUrl", this.defaultServiceUrl);
Expand All @@ -111,32 +108,30 @@ public ModelAndView manage(final HttpServletRequest request,
}

/**
* Updates the {@link RegisteredService#getEvaluationOrder()}. Expects an <code>id</code> parameter to indicate
* the {@link RegisteredService#getId()} and the new <code>evaluationOrder</code> integer parameter from the request.
*
* @param request The request object that is expected to contain the <code>id</code> and <code>evaluationOrder</code>
* as parameters.
* @param response The response object.
*
* @returns {@link ModelAndView} object that redirects to a <code>jsonView</code>. The model will contain a
* a parameter <code>error</code> whose value should describe the error occurred if the update is unsuccesful.
* There will also be a <code>successful</code> boolean parameter that indicates whether or not the update
* was successful.
*
* @throws IllegalArgumentException If either of the <code>id</code> or <code>evaluationOrder</code> are invalid
* or if the service cannot be located for that id by the active implementation of the {@link ServicesManager}.
*/
* Updates the {@link RegisteredService#getEvaluationOrder()}. Expects an <code>id</code> parameter to indicate
* the {@link RegisteredService#getId()} and the new <code>evaluationOrder</code> integer parameter from the request.
* @param request The request object that is expected to contain the <code>id</code> and <code>evaluationOrder</code>
* as parameters.
* @param response The response object.
* @returns {@link ModelAndView} object that redirects to a <code>jsonView</code>. The model will contain a
* a parameter <code>error</code> whose value should describe the error occurred if the update is unsuccesful.
* There will also be a <code>successful</code> boolean parameter that indicates whether or not the update
* was successful.
* @throws IllegalArgumentException If either of the <code>id</code> or <code>evaluationOrder</code> are invalid
* or if the service cannot be located for that id by the active implementation of the {@link ServicesManager}.
*/
public ModelAndView updateRegisteredServiceEvaluationOrder(final HttpServletRequest request, final HttpServletResponse response) {
long id = Long.parseLong(request.getParameter("id"));
int evaluationOrder = Integer.parseInt(request.getParameter("evaluationOrder"));

final RegisteredService svc = this.servicesManager.findServiceBy(id);
if (svc == null)
if (svc == null) {
throw new IllegalArgumentException("Service id " + id + " cannot be found.");

}

svc.setEvaluationOrder(evaluationOrder);
this.servicesManager.save(svc);

return new ModelAndView("jsonView");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,13 @@

/**
* SimpleFormController to handle adding/editing of RegisteredServices.
*
*
* @author Scott Battaglia
* @version $Revision$ $Date$
* @since 3.1
*/
public final class RegisteredServiceSimpleFormController extends SimpleFormController {

/** Instance of ServiceRegistryManager */
/** Instance of ServiceRegistryManager. */
@NotNull
private final ServicesManager servicesManager;

Expand All @@ -59,38 +58,40 @@ public final class RegisteredServiceSimpleFormController extends SimpleFormContr
private final IPersonAttributeDao personAttributeDao;

public RegisteredServiceSimpleFormController(
final ServicesManager servicesManager,
final IPersonAttributeDao attributeRepository) {
final ServicesManager servicesManager,
final IPersonAttributeDao attributeRepository) {
this.servicesManager = servicesManager;
this.personAttributeDao = attributeRepository;
}

/**
* Sets the require fields and the disallowed fields from the
* HttpServletRequest.
*
*
* @see org.springframework.web.servlet.mvc.BaseCommandController#initBinder(javax.servlet.http.HttpServletRequest,
* org.springframework.web.bind.ServletRequestDataBinder)
*/
@Override
protected final void initBinder(final HttpServletRequest request,
final ServletRequestDataBinder binder) throws Exception {
final ServletRequestDataBinder binder) throws Exception {
binder.setRequiredFields(new String[] {"description", "serviceId",
"name", "allowedToProxy", "enabled", "ssoEnabled",
"anonymousAccess", "evaluationOrder"});
"name", "allowedToProxy", "enabled", "ssoEnabled",
"anonymousAccess", "evaluationOrder"});
binder.setDisallowedFields(new String[] {"id"});
binder.registerCustomEditor(String.class, new StringTrimmerEditor(true));
}

/**
* Adds the service to the ServiceRegistry via the ServiceRegistryManager.
*
*
* @see org.springframework.web.servlet.mvc.SimpleFormController#onSubmit(javax.servlet.http.HttpServletRequest,
* javax.servlet.http.HttpServletResponse, java.lang.Object,
* org.springframework.validation.BindException)
*/
@Override
protected final ModelAndView onSubmit(final HttpServletRequest request,
final HttpServletResponse response, final Object command,
final BindException errors) throws Exception {
final HttpServletResponse response, final Object command,
final BindException errors) throws Exception {
RegisteredService service = (RegisteredService) command;

// only change object class if there isn't an explicit RegisteredService class set
Expand All @@ -108,15 +109,16 @@ protected final ModelAndView onSubmit(final HttpServletRequest request,
logger.info("Saved changes to service " + service.getId());

final ModelAndView modelAndView = new ModelAndView(new RedirectView(
"manage.html#" + service.getId(), true));
"manage.html#" + service.getId(), true));
modelAndView.addObject("action", "add");
modelAndView.addObject("id", service.getId());

return modelAndView;
}

@Override
protected Object formBackingObject(final HttpServletRequest request)
throws Exception {
throws Exception {
final String id = request.getParameter("id");

if (!StringUtils.hasText(id)) {
Expand All @@ -130,9 +132,9 @@ protected Object formBackingObject(final HttpServletRequest request)
logger.debug("Created new service of type " + service.getClass().getName());
return service;
}

final RegisteredService service = this.servicesManager.findServiceBy(Long.parseLong(id));

if (service != null) {
logger.debug("Loaded service " + service.getServiceId());
} else {
Expand All @@ -144,24 +146,25 @@ protected Object formBackingObject(final HttpServletRequest request)

/**
* Returns the attributes, page title, and command name.
*
*
* @see org.springframework.web.servlet.mvc.SimpleFormController#referenceData(javax.servlet.http.HttpServletRequest)
*/
@Override
protected final Map referenceData(final HttpServletRequest request) throws Exception {

final Map<String, Object> model = new HashMap<String, Object>();

final List<String> possibleAttributeNames = new ArrayList<String>();
possibleAttributeNames.addAll(this.personAttributeDao.getPossibleUserAttributeNames());
possibleAttributeNames.addAll(this.personAttributeDao.getPossibleUserAttributeNames());
Collections.sort(possibleAttributeNames);
model.put("availableAttributes", possibleAttributeNames);

final List<String> possibleUsernameAttributeNames = new ArrayList<String>();
possibleUsernameAttributeNames.addAll(possibleAttributeNames);
possibleUsernameAttributeNames.addAll(possibleAttributeNames);
possibleUsernameAttributeNames.add(0, "");
model.put("availableUsernameAttributes", possibleUsernameAttributeNames);


model.put("pageTitle", getFormView());
model.put("commandName", getCommandName());
return model;
Expand Down
Loading

0 comments on commit 9d27642

Please sign in to comment.