Examples of InsufficientScopeException


Examples of org.springframework.security.oauth2.common.exceptions.InsufficientScopeException

            break;
          }
        }

        if (result == ACCESS_DENIED && throwException) {
          InsufficientScopeException failure = new InsufficientScopeException(
              "Insufficient scope for this resource", client.getScope());
          throw new AccessDeniedException(failure.getMessage(), failure);
        }

        return result;
      }
    }
View Full Code Here

Examples of org.springframework.security.oauth2.common.exceptions.InsufficientScopeException

          if (attribute.getAttribute().toUpperCase().equals((scopePrefix + scope).toUpperCase())) {
            return ACCESS_GRANTED;
          }
        }
        if (result == ACCESS_DENIED && throwException) {
          InsufficientScopeException failure = new InsufficientScopeException(
              "Insufficient scope for this resource", Collections.singleton(attribute.getAttribute()
                  .substring(scopePrefix.length())));
          throw new AccessDeniedException(failure.getMessage(), failure);
        }
      }
    }

    return result;
View Full Code Here

Examples of org.springframework.security.oauth2.common.exceptions.InsufficientScopeException

   * @return true if the OAuth2 token has one of these scopes
   * @throws InsufficientScopeException if the scope is invalid and we the flag is set to throw the exception
   */
  public boolean throwOnError(boolean decision) {
    if (!decision && !missingScopes.isEmpty()) {
      Throwable failure = new InsufficientScopeException("Insufficient scope for this resource", missingScopes);
      throw new AccessDeniedException(failure.getMessage(), failure);
    }
    return decision;
  }
View Full Code Here

Examples of org.springframework.security.oauth2.common.exceptions.InsufficientScopeException

  }

  @Test
  public void readValueIsufficientScope() throws Exception {
    String accessToken = "{\"error\": \"insufficient_scope\", \"error_description\": \"insufficient scope\", \"scope\": \"bar foo\"}";
    InsufficientScopeException result = (InsufficientScopeException) mapper.readValue(accessToken, OAuth2Exception.class);
    assertEquals("insufficient scope",result.getMessage());
    assertEquals("bar foo",result.getAdditionalInformation().get("scope").toString());
  }
View Full Code Here

Examples of org.springframework.security.oauth2.common.exceptions.InsufficientScopeException

  }

  @Test
  public void readValueIsufficientScope() throws Exception {
    String accessToken = "{\"error\": \"insufficient_scope\", \"error_description\": \"insufficient scope\", \"scope\": \"bar foo\"}";
    InsufficientScopeException result = (InsufficientScopeException) mapper.readValue(accessToken, OAuth2Exception.class);
    assertEquals("insufficient scope",result.getMessage());
    assertEquals("bar foo",result.getAdditionalInformation().get("scope").toString());
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.