/** * Gets JWKS used to sign RPTs. * * @param request the request * @param response the response * @return redirect view */ @GetMapping(value = '/' + OAuth20Constants.BASE_OAUTH20_URL + "/" + OAuth20Constants.UMA_JWKS_URL, produces = MediaType.APPLICATION_JSON_VALUE) public ResponseEntity<String> getKeys(final HttpServletRequest request, final HttpServletResponse response) { try { val jwks = casProperties.getAuthn().getUma().getRequestingPartyToken().getJwksFile(); if (ResourceUtils.doesResourceExist(jwks)) { val jsonJwks = IOUtils.toString(jwks.getInputStream(), StandardCharsets.UTF_8); val jsonWebKeySet = new JsonWebKeySet(jsonJwks); val body = jsonWebKeySet.toJson(JsonWebKey.OutputControlLevel.PUBLIC_ONLY); response.setContentType(MediaType.APPLICATION_JSON_VALUE); return new ResponseEntity<>(body, HttpStatus.OK); } return new ResponseEntity<>("UMA RPT JWKS resource is undefined or cannot be located", HttpStatus.NOT_IMPLEMENTED); } catch (final Exception e) { LOGGER.error(e.getMessage(), e); return new ResponseEntity<>(e.getMessage(), HttpStatus.BAD_REQUEST); } } }
@Override public UmaServerDiscoverySettings getObject() { val uma = casProperties.getAuthn().getUma(); return new UmaServerDiscoverySettings(casProperties, uma.getIssuer()); }
/** * Gets resource set uri location. * * @param saved the saved * @return the resource set uri location */ protected String getResourceSetUriLocation(final ResourceSet saved) { return casProperties.getAuthn().getUma().getIssuer() + OAuth20Constants.BASE_OAUTH20_URL + "/" + OAuth20Constants.UMA_RESOURCE_SET_REGISTRATION_URL + "/" + saved.getId(); } }
claims.setIssuer(casProperties.getAuthn().getUma().getIssuer()); claims.setAudience(String.valueOf(permissionTicket.getResourceSet().getId()));
val timeout = Beans.newDuration(casProperties.getAuthn().getUma().getRequestingPartyToken().getMaxTimeToLiveInSeconds()).getSeconds(); request.setAttribute(UmaPermissionTicket.class.getName(), permissionTicket); request.setAttribute(ResourceSet.class.getName(), resourceSet);