当前位置: 首页>>代码示例>>Java>>正文


Java ClientAuthenticationException类代码示例

本文整理汇总了Java中org.springframework.security.oauth2.common.exceptions.ClientAuthenticationException的典型用法代码示例。如果您正苦于以下问题:Java ClientAuthenticationException类的具体用法?Java ClientAuthenticationException怎么用?Java ClientAuthenticationException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ClientAuthenticationException类属于org.springframework.security.oauth2.common.exceptions包,在下文中一共展示了ClientAuthenticationException类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: isAuthenticationError

import org.springframework.security.oauth2.common.exceptions.ClientAuthenticationException; //导入依赖的package包/类
public static boolean isAuthenticationError(Throwable t) {
  if (t instanceof AccessDeniedException
      || t instanceof AuthenticationException
      || t instanceof ClientAuthenticationException
      || t instanceof ClientRegistrationException
      || t instanceof AuthenticationError
      || (t instanceof AsyncHttpException)
          && ((AsyncHttpException) t).getStatusCode() == HttpStatus.SC_UNAUTHORIZED) {
    return true;
  }

  Throwable cause = t.getCause();
  if (cause != t && cause != null && isAuthenticationError(cause)) {
    return true;
  }

  if (t instanceof InvocationTargetException) {
    Throwable target = ((InvocationTargetException) t).getTargetException();
    if (isAuthenticationError(target)) {
      return true;
    }
  }

  return false;
}
 
开发者ID:tfeng,项目名称:play-plugins,代码行数:26,代码来源:OAuth2Plugin.java

示例2: onError

import org.springframework.security.oauth2.common.exceptions.ClientAuthenticationException; //导入依赖的package包/类
@Override
public Promise<Result> onError(RequestHeader request, Throwable t) {
  Throwable cause = t.getCause();
  if (cause instanceof AuthenticationException
      || cause instanceof ClientAuthenticationException
      || cause instanceof ClientRegistrationException) {
    return Promise.pure(Results.unauthorized());
  } else {
    return Promise.pure(Results.internalServerError());
  }
}
 
开发者ID:tfeng,项目名称:play-oauth2,代码行数:12,代码来源:Global.java

示例3: handleException

import org.springframework.security.oauth2.common.exceptions.ClientAuthenticationException; //导入依赖的package包/类
private ModelAndView handleException(Exception e, ServletWebRequest webRequest) throws Exception {

		ResponseEntity<OAuth2Exception> translate = getExceptionTranslator().translate(e);
		webRequest.getResponse().setStatus(translate.getStatusCode().value());

		if (e instanceof ClientAuthenticationException || e instanceof RedirectMismatchException) {
			return new ModelAndView(errorPage, Collections.singletonMap("error", translate.getBody()));
		}

		AuthorizationRequest authorizationRequest = null;
		try {
			authorizationRequest = getAuthorizationRequestForError(webRequest);
			String requestedRedirectParam = authorizationRequest.getRequestParameters().get(OAuth2Utils.REDIRECT_URI);
			String requestedRedirect = redirectResolver.resolveRedirect(requestedRedirectParam,
					getClientDetailsService().loadClientByClientId(authorizationRequest.getClientId()));
			authorizationRequest.setRedirectUri(requestedRedirect);
			String redirect = getUnsuccessfulRedirect(authorizationRequest, translate.getBody(), authorizationRequest
					.getResponseTypes().contains("token"));
			return new ModelAndView(new RedirectView(redirect, false, true, false));
		}
		catch (OAuth2Exception ex) {
			// If an AuthorizationRequest cannot be created from the incoming parameters it must be
			// an error. OAuth2Exception can be handled this way. Other exceptions will generate a standard 500
			// response.
			return new ModelAndView(errorPage, Collections.singletonMap("error", translate.getBody()));
		}

	}
 
开发者ID:jungyang,项目名称:oauth-client-master,代码行数:29,代码来源:AuthorizationEndpoint.java

示例4: doFilter

import org.springframework.security.oauth2.common.exceptions.ClientAuthenticationException; //导入依赖的package包/类
/**
 * Check access token cookie and refresh it, if it is either not present, expired or about to expire.
 */
@Override
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain)
    throws IOException, ServletException {
    HttpServletRequest httpServletRequest = (HttpServletRequest) servletRequest;
    HttpServletResponse httpServletResponse = (HttpServletResponse) servletResponse;
    try {
        httpServletRequest = refreshTokensIfExpiring(httpServletRequest, httpServletResponse);
    } catch (ClientAuthenticationException ex) {
        log.warn("Security exception: could not refresh tokens", ex);
        httpServletRequest = authenticationService.stripTokens(httpServletRequest);
    }
    filterChain.doFilter(httpServletRequest, servletResponse);
}
 
开发者ID:jhipster,项目名称:generator-jhipster,代码行数:17,代码来源:_RefreshTokenFilter.java

示例5: handleClientAuthenticationException

import org.springframework.security.oauth2.common.exceptions.ClientAuthenticationException; //导入依赖的package包/类
@ExceptionHandler(ClientAuthenticationException.class)
public ResponseEntity<OAuth2Exception> handleClientAuthenticationException(ClientAuthenticationException e)
        throws Exception {
    return getExceptionTranslator().translate(e);
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:6,代码来源:IdpAuthController.java

示例6: handleClientAuthenticationException

import org.springframework.security.oauth2.common.exceptions.ClientAuthenticationException; //导入依赖的package包/类
@ExceptionHandler(ClientAuthenticationException.class)
public ResponseEntity<OAuth2Exception> handleClientAuthenticationException(ClientAuthenticationException e) throws Exception {
    return getExceptionTranslator().translate(e);
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:5,代码来源:LdapAuthController.java


注:本文中的org.springframework.security.oauth2.common.exceptions.ClientAuthenticationException类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。