/** * Constructs the Url for Redirection to the CAS server. Default implementation relies * on the CAS client to do the bulk of the work. * * @param serviceUrl the service url that should be included. * @return the redirect url. CANNOT be NULL. */ protected String createRedirectUrl(final String serviceUrl) { return CommonUtils.constructRedirectUrl(this.loginUrl, this.serviceProperties.getServiceParameter(), serviceUrl, this.serviceProperties.isSendRenew(), false); }
/** * Constructs a new Service Url. The default implementation relies on the CAS client * to do the bulk of the work. * @param request the HttpServletRequest * @param response the HttpServlet Response * @return the constructed service url. CANNOT be NULL. */ protected String createServiceUrl(final HttpServletRequest request, final HttpServletResponse response) { return CommonUtils.constructServiceUrl(null, response, this.serviceProperties.getService(), null, this.serviceProperties.getArtifactParameter(), this.encodeServiceUrlWithSessionId); }
@Override public Authentication attemptAuthentication(final HttpServletRequest request, final HttpServletResponse response) throws AuthenticationException, IOException { // if the request is a proxy request process it and return null to indicate the // request has been processed if (proxyReceptorRequest(request)) { logger.debug("Responding to proxy receptor request"); CommonUtils.readAndRespondToProxyReceptorRequest(request, response, this.proxyGrantingTicketStorage); return null; } final boolean serviceTicketRequest = serviceTicketRequest(request, response); final String username = serviceTicketRequest ? CAS_STATEFUL_IDENTIFIER : CAS_STATELESS_IDENTIFIER; String password = obtainArtifact(request); if (password == null) { logger.debug("Failed to obtain an artifact (cas ticket)"); password = ""; } final UsernamePasswordAuthenticationToken authRequest = new UsernamePasswordAuthenticationToken( username, password); authRequest.setDetails(authenticationDetailsSource.buildDetails(request)); return this.getAuthenticationManager().authenticate(authRequest); }
public void init() { super.init(); CommonUtils.assertNotNull(this.ticketValidator, "ticketValidator cannot be null."); }
public final void init(final FilterConfig filterConfig) throws ServletException { super.init(filterConfig); if (!isIgnoreInitConfiguration()) { setServerName(getString(ConfigurationKeys.SERVER_NAME)); setService(getString(ConfigurationKeys.SERVICE)); setEncodeServiceUrl(getBoolean(ConfigurationKeys.ENCODE_SERVICE_URL)); initInternal(filterConfig); } init(); }
public void testIsNotBlank() { assertTrue(CommonUtils.isNotBlank("test")); assertTrue(CommonUtils.isNotBlank(" test")); assertFalse(CommonUtils.isNotBlank("")); assertFalse(CommonUtils.isNotBlank(null)); assertFalse(CommonUtils.isNotBlank(" ")); }
/** * Sets the name of the CAS principal attribute that contains role data. * * @param roleAttribute Role attribute name. MUST NOT be blank. */ public void setRoleAttribute(final String roleAttribute) { CommonUtils.isNotBlank(roleAttribute); this.roleAttribute = roleAttribute; }
/** * Test method for {@link org.jasig.cas.client.util.ReflectUtils#newInstance(java.lang.String, java.lang.Object[])}. */ public void testNewInstanceStringObjectArray() { final Object result = ReflectUtils.newInstance("org.jasig.cas.client.validation.Cas10TicketValidator", new Object[] { "https://localhost/cas" }); assertNotNull(result); }
/** * Test method for {@link org.jasig.cas.client.util.ReflectUtils#setProperty(java.lang.String, java.lang.Object, java.lang.Object)}. */ public void testSetPropertyStringObjectObject() { final TestBean bean = new TestBean(); ReflectUtils.setProperty("count", new Integer(30000), bean); assertEquals(30000, bean.getCount()); ReflectUtils.setProperty("name", "bob", bean); assertEquals("bob", bean.getName()); ReflectUtils.setProperty("flag", Boolean.TRUE, bean); assertTrue(bean.isFlag()); }
public void testIsNotEmpty() { assertTrue(CommonUtils.isNotEmpty("test")); assertTrue(CommonUtils.isNotEmpty(" test")); assertFalse(CommonUtils.isNotEmpty("")); assertFalse(CommonUtils.isNotEmpty(null)); assertTrue(CommonUtils.isNotEmpty(" ")); }
public void testGetFieldSuperclass() { final TestSubBean bean = new TestSubBean(); bean.setName("bob"); assertEquals(bean.getName(), ReflectUtils.getField("name", bean)); }
public void testGetField() { final TestBean bean = new TestBean(); bean.setName("bob"); assertEquals(bean.getName(), ReflectUtils.getField("name", bean)); }
public void testIsEmpty() { assertFalse(CommonUtils.isEmpty("test")); assertFalse(CommonUtils.isEmpty(" test")); assertTrue(CommonUtils.isEmpty("")); assertTrue(CommonUtils.isEmpty(null)); assertFalse(CommonUtils.isEmpty(" ")); }
public void testIsBlank() { assertFalse(CommonUtils.isBlank("test")); assertFalse(CommonUtils.isBlank(" test")); assertTrue(CommonUtils.isBlank("")); assertTrue(CommonUtils.isBlank(null)); assertTrue(CommonUtils.isBlank(" ")); }
/** * Determines if the String is not empty. A string is not empty if it is not * null and has a length > 0. * * @param string the string to check * @return true if it is not empty, false otherwise. */ public static boolean isNotEmpty(final String string) { return !isEmpty(string); }
public void init(final FilterConfig filterConfig) throws ServletException { super.init(filterConfig); this.roleAttribute = getString(ConfigurationKeys.ROLE_ATTRIBUTE); this.ignoreCase = getBoolean(ConfigurationKeys.IGNORE_CASE); }
public void testUrlEncode() { assertEquals("this+is+a+very+special+parameter+with+%3D%25%2F", CommonUtils.urlEncode("this is a very special parameter with =%/")); }
/** * Reads all data from the given stream as UTF-8 character data and closes it on completion or errors. * * @param in Input stream containing character data. * * @return String of all data in stream. * * @throws IOException On IO errors. */ public static String readString(final InputStream in) throws IOException { return readString(in, UTF8); }
public void init() { super.init(); CommonUtils.assertNotNull(this.ticketValidator, "ticketValidator cannot be null."); }
public void init() { super.init(); CommonUtils.assertNotNull(this.casServerLoginUrl, "casServerLoginUrl cannot be null."); }