use of io.github.tesla.authz.domain.ClientDetails in project tesla by linking12.
the class OAuthHandler method createTokenResponse.
protected OAuthResponse createTokenResponse(AccessToken accessToken, boolean queryOrJson) throws OAuthSystemException {
final ClientDetails tempClientDetails = clientDetails();
final OAuthASResponse.OAuthTokenResponseBuilder builder = OAuthASResponse.tokenResponse(HttpServletResponse.SC_OK).location(tempClientDetails.getRedirectUri()).setAccessToken(accessToken.tokenId()).setExpiresIn(String.valueOf(accessToken.currentTokenExpiredSeconds())).setTokenType(accessToken.tokenType());
final String refreshToken = accessToken.refreshToken();
if (StringUtils.isNotEmpty(refreshToken)) {
builder.setRefreshToken(refreshToken);
}
return queryOrJson ? builder.buildQueryMessage() : builder.buildJSONMessage();
}
use of io.github.tesla.authz.domain.ClientDetails in project tesla by linking12.
the class TokenAuthorizeHandler method expiredTokenResponse.
private void expiredTokenResponse(AccessToken accessToken) throws OAuthSystemException {
final ClientDetails clientDetails = clientDetails();
LOG.debug("AccessToken {} is expired", accessToken);
final OAuthResponse oAuthResponse = OAuthASResponse.errorResponse(HttpServletResponse.SC_FOUND).setError(OAuthError.ResourceResponse.EXPIRED_TOKEN).setErrorDescription("access_token '" + accessToken.tokenId() + "' expired").setErrorUri(clientDetails.getRedirectUri()).buildJSONMessage();
WebUtils.writeOAuthJsonResponse(response, oAuthResponse);
}
use of io.github.tesla.authz.domain.ClientDetails in project tesla by linking12.
the class Oauth2Controller method listClients.
@ResponseBody
@GetMapping("/listClient")
@RequiresPermissions("sys:oauth2:listclient")
PageDO<ClientDetails> listClients(@RequestParam Map<String, Object> params) {
Query query = new Query(params);
PageDO<ClientDetails> page = oauth2Service.queryClientDetailsList(query);
return page;
}
use of io.github.tesla.authz.domain.ClientDetails in project tesla by linking12.
the class Oauth2Controller method edit.
@Log("编辑客户端")
@RequiresPermissions("sys:oauth2:edit")
@GetMapping("/edit/{id}")
String edit(@PathVariable("id") String id, Model model) {
ClientDetails client = oauth2Service.get(id);
model.addAttribute("client", client);
return prefix + "/edit";
}
use of io.github.tesla.authz.domain.ClientDetails in project tesla by linking12.
the class CodeAuthorizeHandler method handleResponse.
@Override
protected void handleResponse() throws OAuthSystemException, IOException {
final ClientDetails clientDetails = clientDetails();
final String authCode = oauthService.retrieveAuthCode(clientDetails);
final OAuthResponse oAuthResponse = OAuthASResponse.authorizationResponse(oauthRequest.request(), HttpServletResponse.SC_OK).location(clientDetails.getRedirectUri()).setCode(authCode).buildQueryMessage();
LOG.debug(" 'code' response: {}", oAuthResponse);
WebUtils.writeOAuthQueryResponse(response, oAuthResponse);
}
Aggregations