コード例 #1
0
 public void filter(ContainerRequestContext context) {
   try {
     interceptor.handleMessage(JAXRSUtils.getCurrentMessage());
   } catch (AccessDeniedException ex) {
     context.abortWith(Response.status(Response.Status.FORBIDDEN).build());
   }
 }
コード例 #2
0
 protected MultivaluedMap<String, String> toRequestState(ContainerRequestContext rc, UriInfo ui) {
   MultivaluedMap<String, String> requestState = new MetadataMap<String, String>();
   requestState.putAll(ui.getQueryParameters(decodeRequestParameters));
   if (MediaType.APPLICATION_FORM_URLENCODED_TYPE.isCompatible(rc.getMediaType())) {
     String body = FormUtils.readBody(rc.getEntityStream(), StandardCharsets.UTF_8.name());
     FormUtils.populateMapFromString(
         requestState,
         JAXRSUtils.getCurrentMessage(),
         body,
         StandardCharsets.UTF_8.name(),
         decodeRequestParameters);
   }
   return requestState;
 }
コード例 #3
0
 private void setAtHashAndNonce(IdToken idToken, ServerAccessToken st) {
   if (idToken.getAccessTokenHash() == null) {
     Properties props = JwsUtils.loadSignatureOutProperties(false);
     SignatureAlgorithm sigAlgo = null;
     if (super.isSignWithClientSecret()) {
       sigAlgo = OAuthUtils.getClientSecretSignatureAlgorithm(props);
     } else {
       sigAlgo = JwsUtils.getSignatureAlgorithm(props, SignatureAlgorithm.RS256);
     }
     if (sigAlgo != SignatureAlgorithm.NONE) {
       String atHash = OidcUtils.calculateAccessTokenHash(st.getTokenKey(), sigAlgo);
       idToken.setAccessTokenHash(atHash);
     }
   }
   Message m = JAXRSUtils.getCurrentMessage();
   if (m != null && m.getExchange().containsKey(OAuthConstants.NONCE)) {
     idToken.setNonce((String) m.getExchange().get(OAuthConstants.NONCE));
   } else if (st.getNonce() != null) {
     idToken.setNonce(st.getNonce());
   }
 }
コード例 #4
0
 private void setClientCodeRequest(ClientTokenContext request) {
   JAXRSUtils.getCurrentMessage().setContent(ClientTokenContext.class, request);
 }