private PlayWebContext getPlayWebContext(final WebContext context) { CommonHelper.assertTrue(context instanceof PlayWebContext, "context must be a PlayWebContext"); return (PlayWebContext) context; } /**
@Override protected void internalInit() { CommonHelper.assertTrue(this.timeout >= 0, "timeout must be greater than zero"); if (this.cache == null && this.cacheProvider == null) { throw new TechnicalException("The cache and the cacheProvider must not be both null"); } }
@Override protected void internalInit() { CommonHelper.assertTrue(this.timeout >= 0, "timeout must be greater than zero"); if (this.cache == null && this.cacheProvider == null) { throw new TechnicalException("The cache and the cacheProvider must not be both null"); } }
public String getAccessTokenFromRefreshToken(AzureAdProfile azureAdProfile) { CommonHelper.assertTrue(CommonHelper.isNotBlank(getConfiguration().getTenant()), "Tenant must be defined. Update your config."); HttpURLConnection connection = null;
@Override protected AuthenticationToken createToken(final ServletRequest request, final ServletResponse response) throws Exception { final J2EContext context = new J2EContext(WebUtils.toHttp(request), WebUtils.toHttp(response), new ShiroSessionStore()); final Client<Credentials, UserProfile> client = getClients().findClient(context); CommonHelper.assertNotNull("client", client); CommonHelper.assertTrue(client instanceof IndirectClient, "only indirect clients are allowed on the callback url"); log.debug("client : {}", client); Credentials credentials = null; try { credentials = client.getCredentials(context); log.debug("credentials : {}", credentials); } catch (Exception e) { log.info("用户取消登录或第三方回调错误"); } return credentials != null ? new UsernamePasswordAndClientToken(client.getName(), credentials, context) : null; }
CommonHelper.assertTrue(CommonHelper.isNotEmpty(metadataAlgorithms), "There must at least one JWS algorithm supported on the OpenID Connect provider side"); List<JWSAlgorithm> jwsAlgorithms = new ArrayList<>();
public Result callback() { final PlayWebContext context = new PlayWebContext(ctx(), config.getSessionStore()); CommonHelper.assertNotNull("config", config); CommonHelper.assertNotNull("config.httpActionAdapter", config.getHttpActionAdapter()); final Clients clients = config.getClients(); CommonHelper.assertNotNull("clients", clients); final Client client = clients.findClient(context); logger.debug("client: {}", client); CommonHelper.assertNotNull("client", client); CommonHelper.assertTrue(client instanceof IndirectClient, "only indirect clients are allowed on the callback url"); final Credentials credentials; try { credentials = client.getCredentials(context); } catch (final RequiresHttpAction e) { return (Result) config.getHttpActionAdapter().adapt(e.getCode(), context); } logger.debug("credentials: {}", credentials); final UserProfile profile = client.getUserProfile(credentials, context); logger.debug("profile: {}", profile); saveUserProfile(context, profile); return redirectToOriginallyRequestedUrl(context); }