List of usage examples for org.springframework.security.web.util UrlUtils isAbsoluteUrl
public static boolean isAbsoluteUrl(String url)
From source file:com.excilys.ebi.bank.web.tld.Functions.java
public static String url(String url) { // don't touch absolute URLs if (UrlUtils.isAbsoluteUrl(url)) return url; // normalize relative URLs against a context root if (url.startsWith("/")) return (ctx() + url); else/* www.ja v a 2 s . c o m*/ return url; }
From source file:org.vaadin.spring.security.web.DefaultVaadinRedirectStrategy.java
private String calculateRedirectUrl(String contextPath, String url) { if (!UrlUtils.isAbsoluteUrl(url)) { if (contextRelative) { return url; } else {/*from w w w. ja v a2 s . c o m*/ return contextPath + url; } } // Full URL, including http(s):// if (!contextRelative) { return url; } // Calculate the relative URL from the fully qualified URL, minus the last // occurrence of the scheme and base context. url = url.substring(url.lastIndexOf("://") + 3); // strip off scheme url = url.substring(url.indexOf(contextPath) + contextPath.length()); if (url.length() > 1 && url.charAt(0) == '/') { url = url.substring(1); } return url; }
From source file:grails.plugin.springsecurity.web.GrailsRedirectStrategy.java
protected String calculateRedirectUrl(HttpServletRequest request, String url) { if (UrlUtils.isAbsoluteUrl(url)) { return url; }//from ww w . j a va 2s .c o m url = request.getContextPath() + url; if (!useHeaderCheckChannelSecurity) { return url; } return UrlUtils.buildFullRequestUrl(request.getScheme(), request.getServerName(), portResolver.getServerPort(request), url, null); }
From source file:br.com.wavii.securyti.JsfAccessDeniedHandler.java
private String calculateRedirectUrl(String contextPath, String url) { if (!UrlUtils.isAbsoluteUrl(url)) { if (!contextRelative) { return url; } else {//from w ww . ja v a 2 s.c o m return contextPath + url; } } // Full URL, including http(s):// if (!contextRelative) { return url; } // Calculate the relative URL from the fully qualified URL, minus the // scheme and base context. url = url.substring(url.indexOf("://") + 3); // strip off scheme url = url.substring(url.indexOf(contextPath) + contextPath.length()); if (url.length() > 1 && url.charAt(0) == '/') { url = url.substring(1); } return url; }
From source file:br.com.gerenciapessoal.security.JsfAccessDeniedHandler.java
private String calculateRedirectUrl(String contextPath, String url) { if (!UrlUtils.isAbsoluteUrl(url)) { if (!contextRelative) { return url; } else {//from www. ja v a 2 s .c om return contextPath + url; } } // Full URL, including http(s):// if (!contextRelative) { return url; } // Calculate the relative URL from the fully qualified URL, minus the scheme and base context. url = url.substring(url.indexOf("://") + 3); // strip off scheme url = url.substring(url.indexOf(contextPath) + contextPath.length()); if (url.length() > 1 && url.charAt(0) == '/') { url = url.substring(1); } return url; }
From source file:br.com.flucianofeijao.security.JsfAccessDeniedHandler.java
private String calculateRedirectUrl(String contextPath, String url) { if (!UrlUtils.isAbsoluteUrl(url)) { if (!contextRelative) { return url; } else {/*from ww w . java 2 s . c om*/ return contextPath + url; } } // Full URL, including http(s):// if (!contextRelative) { return url; } // Calculate the relative URL from the fully qualified URL, minus the scheme and base context. url = url.substring(url.indexOf("://") + 3); // strip off scheme url = url.substring(url.indexOf(contextPath) + contextPath.length()); if (url.length() > 1 && url.charAt(0) == '/') { url = url.substring(1); } return url; }
From source file:org.xine.marketplace.frontend.views.security.JsfAccessDeniedHandler.java
private String calculateRedirectUrl(final String contextPath, String url) { if (!UrlUtils.isAbsoluteUrl(url)) { if (!this.contextRelative) { return url; }//from www. j a va2s .c o m return contextPath + url; } // Full URL, including http(s):// if (!this.contextRelative) { return url; } // Calculate the relative URL from the fully qualified URL, minus the scheme and base // context. url = url.substring(url.indexOf("://") + 3); // strip off scheme url = url.substring(url.indexOf(contextPath) + contextPath.length()); if (url.length() > 1 && url.charAt(0) == '/') { url = url.substring(1); } return url; }
From source file:br.com.flucianofeijao.security.JsfLoginUrlAuthenticationEntryPoint.java
public void afterPropertiesSet() throws Exception { Assert.isTrue(StringUtils.hasText(loginFormUrl) && UrlUtils.isValidRedirectUrl(loginFormUrl), "loginFormUrl must be specified and must be a valid redirect URL"); if (useForward && UrlUtils.isAbsoluteUrl(loginFormUrl)) { throw new IllegalArgumentException("useForward must be false if using an absolute loginFormURL"); }/* www . ja v a 2 s . c o m*/ Assert.notNull(portMapper, "portMapper must be specified"); Assert.notNull(portResolver, "portResolver must be specified"); }
From source file:br.com.gerenciapessoal.security.JsfLoginUrlAuthenticationEntryPoint.java
@Override public void afterPropertiesSet() throws Exception { Assert.isTrue(StringUtils.hasText(loginFormUrl) && UrlUtils.isValidRedirectUrl(loginFormUrl), "loginFormUrl must be specified and must be a valid redirect URL"); if (useForward && UrlUtils.isAbsoluteUrl(loginFormUrl)) { throw new IllegalArgumentException("useForward must be false if using an absolute loginFormURL"); }/* w ww . ja v a 2 s . c o m*/ Assert.notNull(portMapper, "portMapper must be specified"); Assert.notNull(portResolver, "portResolver must be specified"); }
From source file:br.com.sisped.security.JsfRedirectStrategy.java
private String calculateRedirectUrl(String contextPath, String url) { if (!UrlUtils.isAbsoluteUrl(url)) { if (contextRelative) { return url; } else {//from w w w . j a v a2 s . c om return contextPath + url; } } // Full URL, including http(s):// if (!contextRelative) { return url; } // Calculate the relative URL from the fully qualified URL, minus the // scheme and base context. url = url.substring(url.indexOf("://") + 3); // strip off scheme url = url.substring(url.indexOf(contextPath) + contextPath.length()); if (url.length() > 1 && url.charAt(0) == '/') { url = url.substring(1); } return url; }