Examples of TokenGranter


Examples of org.springframework.security.oauth2.provider.TokenGranter

    context = new GenericXmlApplicationContext(getClass(), RESOURCE_NAME);
  }
 
  @Test
  public void testCustomGrantRegistered() {
    TokenGranter granter = context.getBean(CompositeTokenGranter.class);
    assertNotNull("Custom grant registration failed!", granter.grant("test-grant", null));
  }
View Full Code Here

Examples of org.springframework.security.oauth2.provider.TokenGranter

  @Test
  public void testCustomGrantRegistered() {
    expected.expect(BeanDefinitionParsingException.class);
    expected.expectMessage("ClientDetailsService");
    context = new GenericXmlApplicationContext(getClass(), RESOURCE_NAME);
    TokenGranter granter = context.getBean(CompositeTokenGranter.class);
    assertNotNull(granter);
  }
View Full Code Here

Examples of org.springframework.security.oauth2.provider.TokenGranter

    assertTrue("Wrong scope: " + result, url.contains("&scope=read%20write"));
  }

  @Test(expected = InvalidScopeException.class)
  public void testImplicitPreApprovedButInvalid() throws Exception {
    endpoint.setTokenGranter(new TokenGranter() {
      public OAuth2AccessToken grant(String grantType, TokenRequest tokenRequest) {
        throw new IllegalStateException("Shouldn't be called");
      }
    });
    endpoint.setUserApprovalHandler(new DefaultUserApprovalHandler() {
View Full Code Here

Examples of org.springframework.security.oauth2.provider.TokenGranter

    assertTrue("Wrong view: " + result, url.startsWith("http://anywhere.com"));
  }

  @Test
  public void testImplicitUnapproved() throws Exception {
    endpoint.setTokenGranter(new TokenGranter() {
      public OAuth2AccessToken grant(String grantType, TokenRequest tokenRequest) {
        return null;
      }
    });
    AuthorizationRequest authorizationRequest = getAuthorizationRequest("foo", "http://anywhere.com", "mystate",
View Full Code Here

Examples of org.springframework.security.oauth2.provider.TokenGranter

      public boolean isApproved(AuthorizationRequest authorizationRequest, Authentication userAuthentication) {
        return true;
      }
    });
    endpoint.setTokenGranter(new TokenGranter() {
      public OAuth2AccessToken grant(String grantType, TokenRequest tokenRequest) {
        return null;
      }
    });
    AuthorizationRequest authorizationRequest = getAuthorizationRequest("foo", "http://anywhere.com", "mystate",
View Full Code Here

Examples of org.springframework.security.oauth2.provider.TokenGranter

    endpoint.setClientDetailsService(new ClientDetailsService() {
      public ClientDetails loadClientByClientId(String clientId) throws OAuth2Exception {
        return client;
      }
    });
    endpoint.setTokenGranter(new TokenGranter() {
      public OAuth2AccessToken grant(String grantType, TokenRequest tokenRequest) {
        return null;
      }
    });
    endpoint.setRedirectResolver(new DefaultRedirectResolver());
View Full Code Here

Examples of org.springframework.security.oauth2.provider.TokenGranter

    assertEquals("forward:/oauth/confirm_access", result.getViewName());
  }

  @Test
  public void testImplicitPreApproved() throws Exception {
    endpoint.setTokenGranter(new TokenGranter() {

      public OAuth2AccessToken grant(String grantType, TokenRequest tokenRequest) {
        DefaultOAuth2AccessToken token = new DefaultOAuth2AccessToken("FOO");
        token.setAdditionalInformation(Collections.singletonMap("foo", (Object) "bar"));
        return token;
View Full Code Here

Examples of org.springframework.security.oauth2.provider.TokenGranter

    assertTrue("Wrong token: " + result, url.contains("foo=bar"));
  }

  @Test
  public void testImplicitAppendsScope() throws Exception {
    endpoint.setTokenGranter(new TokenGranter() {
      public OAuth2AccessToken grant(String grantType, TokenRequest tokenRequest) {
        DefaultOAuth2AccessToken token = new DefaultOAuth2AccessToken("FOO");
        token.setScope(Collections.singleton("read"));
        return token;
      }
View Full Code Here

Examples of org.springframework.security.oauth2.provider.TokenGranter

    assertTrue("Wrong scope: " + result, url.contains("&scope=read"));
  }

  @Test
  public void testImplicitWithQueryParam() throws Exception {
    endpoint.setTokenGranter(new TokenGranter() {
      public OAuth2AccessToken grant(String grantType, TokenRequest tokenRequest) {
        DefaultOAuth2AccessToken token = new DefaultOAuth2AccessToken("FOO");
        return token;
      }
    });
View Full Code Here

Examples of org.springframework.security.oauth2.provider.TokenGranter

    assertTrue("Wrong url: " + result, url.contains("foo=bar"));
  }

  @Test
  public void testImplicitAppendsScopeWhenDefaulting() throws Exception {
    endpoint.setTokenGranter(new TokenGranter() {
      public OAuth2AccessToken grant(String grantType, TokenRequest tokenRequest) {
        DefaultOAuth2AccessToken token = new DefaultOAuth2AccessToken("FOO");
        token.setScope(new LinkedHashSet<String>(Arrays.asList("read", "write")));
        return token;
      }
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.