Skip to main content

Posts

Showing posts from August, 2011

CAS Proxy Ticket Utility for Alfresco Share Dashlets

Alfresco Share dashlet controllers can be used to call internal (Alfresco Repository) as well as external restful web services. In our environment our external restful web services are protected by CAS. In order to authenticate calls from Alfresco Share dashlets, CAS proxy authentication protocol is used. You can find much about CAS, its supported clients and protocols on their web site at http://www.jasig.org/cas. Cas ProxyAuthentication requires proxy tickets to be submitted with each service call. Therefore, proxy ticket must be generated and attached to each http call from an Alfresco Share dashlet. Here is snippet of a controller from one of our dashlets.  var hoursServiceUrl = remote.getEndpointURL("casProtectedService") + "/users/" + user.name + "/hours.json"; var proxyTicket = proxyTicketUtil.proxyTicket(hoursServiceUrl); var hoursUrl = hoursServiceUrl + "?ticket=" + proxyTicket; var hoursConnector = remote.connect(" casProte...

Spring MVC and Reflection

Annotation based Spring MVC controllers and annotations in general provide flexibility for rapid application development in today's JAVA development environment. When you combine annotations with reflection you get quick, neat and powerful solutions. Here is an example that combines a simple annotated Spring MVC form with reflection. @RequestMapping(method = RequestMethod.POST) public String processSubmit(@ModelAttribute TestPlan testPlan, BindingResult result) { if (result.hasErrors()) { return "test/form"; } else { try { prepareTestPlan(testPlan); // find the right method and execute it Method[] methods = WebServiceTestForm.class.getMethods(); for (Method m : methods) { TestDesc t = m.getAnnotation(TestDesc.class); if (t != null && t.name() != null && t.name().equals(testPlan.getTestName())) { ...