Examples of OAuth2Client


Examples of net.oauth.v2.OAuth2Client

       
      OAuth2Message requestMessage = null;
        try{
            requestMessage = OAuth2Servlet.getMessage(request, null);
           
            OAuth2Client client = SampleOAuth2Provider.getClient(requestMessage);
           
            SampleOAuth2Provider.VALIDATOR.validateRequestMessageForAuthorization(requestMessage,client);
           
            sendToAuthorizePage(request, response, client);
View Full Code Here

Examples of net.oauth.v2.OAuth2Client

            throws IOException, ServletException{
       
        try{
            OAuth2Message requestMessage = OAuth2Servlet.getMessage(request, null);
           
            OAuth2Client client = SampleOAuth2Provider.getClient(requestMessage);
           
            String userId = request.getParameter("userId");
            if(userId == null){
              SampleOAuth2Provider.VALIDATOR.validateRequestMessageForAuthorization(requestMessage,client);
                sendToAuthorizePage(request, response, client);
View Full Code Here

Examples of net.oauth.v2.OAuth2Client

                String consumer_secret = (String) prop.getValue();
                if(consumer_secret != null){
                    String consumer_description = (String) p.getProperty(consumer_key + ".description");
                    String consumer_callback_url =  (String) p.getProperty(consumer_key + ".callbackURL");
                    // Create OAuthConsumer w/ key and secret
                    OAuth2Client client = new OAuth2Client(
                            consumer_callback_url,
                            consumer_key,
                            consumer_secret);
                    client.setProperty("name", consumer_key);
                    client.setProperty("description", consumer_description);
                    ALL_CLIENTS.put(consumer_key, client);
                }
            }
        }
       
View Full Code Here

Examples of net.oauth.v2.OAuth2Client

     */
    public static synchronized OAuth2Client getClient(
            OAuth2Message requestMessage)
            throws IOException, OAuth2ProblemException {
       
        OAuth2Client client = null;
        // try to load from local cache if not throw exception
        String client_id = requestMessage.getClientId();
       
        client = SampleOAuth2Provider.ALL_CLIENTS.get(client_id);
       
View Full Code Here

Examples of net.oauth.v2.OAuth2Client

     */
    public static synchronized OAuth2Client getClientFromAuthHeader(
            OAuth2Message requestMessage)
            throws IOException, OAuth2ProblemException {

        OAuth2Client client = null;
        // try to load from local cache if not throw exception
        String authz = requestMessage.getHeader("Authorization");
        if (authz != null) {
            if(authz.substring(0,5).equals("Basic")){
                String userPass = new String(Base64.decodeBase64(authz.substring(6).getBytes()), "UTF-8");
View Full Code Here

Examples of org.apache.shindig.gadgets.oauth2.persistence.OAuth2Client

    client.setServiceName(MockUtils.SERVICE_NAME);
    client.setTokenUrl(MockUtils.TOKEN_URL);
  }

  protected static OAuth2Client getClient_Code_Confidential() throws Exception {
    final OAuth2Client client = new OAuth2Client(MockUtils.getDummyEncrypter());
    MockUtils.setClientCommons(client);
    client.setClientAuthenticationType(OAuth2Message.BASIC_AUTH_TYPE);
    client.setClientId(MockUtils.CLIENT_ID1);
    client.setClientSecret(MockUtils.CLIENT_SECRET1.getBytes("UTF-8"));
    client.setGadgetUri(MockUtils.GADGET_URI1);
    client.setType(OAuth2Accessor.Type.CONFIDENTIAL);
    client.setAllowModuleOverride(true);
    client.setAuthorizationHeader(true);
    client.setUrlParameter(false);

    return client;
  }
View Full Code Here

Examples of org.apache.shindig.gadgets.oauth2.persistence.OAuth2Client

    return client;
  }

  protected static OAuth2Client getClient_Code_Public() throws Exception {
    final OAuth2Client client = new OAuth2Client(MockUtils.getDummyEncrypter());
    MockUtils.setClientCommons(client);
    client.setClientAuthenticationType(OAuth2Message.STANDARD_AUTH_TYPE);
    client.setClientId(MockUtils.CLIENT_ID2);
    client.setClientSecret(MockUtils.CLIENT_SECRET2.getBytes("UTF-8"));
    client.setGadgetUri(MockUtils.GADGET_URI2);
    client.setType(OAuth2Accessor.Type.PUBLIC);
    client.setAllowModuleOverride(false);
    client.setAuthorizationHeader(false);
    client.setUrlParameter(true);

    return client;
  }
View Full Code Here

Examples of org.apache.shindig.gadgets.oauth2.persistence.OAuth2Client

    Assert.assertNull(this.cache.getToken(MockUtils.ACCESS_TOKEN_INDEX));
  }

  @Test
  public void testGetClient_1() throws Exception {
    final OAuth2Client result = this.cache.getClient(MockUtils.CLIENT_INDEX1);

    Assert.assertNotNull(result);
    Assert.assertEquals(MockUtils.CLIENT_ID1, result.getClientId());
  }
View Full Code Here

Examples of org.apache.shindig.gadgets.oauth2.persistence.OAuth2Client

  }

  @Test
  public void testRemoveClient_1() throws Exception {

    OAuth2Client result = this.cache.getClient(MockUtils.CLIENT_INDEX1);

    Assert.assertNotNull(result);

    result = this.cache.removeClient(MockUtils.CLIENT_INDEX1);
View Full Code Here

Examples of org.apache.shindig.gadgets.oauth2.persistence.OAuth2Client

  }

  @Test
  public void testStoreClient_1() throws Exception {

    OAuth2Client client = new OAuth2Client(MockUtils.getDummyEncrypter());
    client.setGadgetUri("xxx");
    client.setServiceName("yyy");

    final Integer result = this.cache.storeClient(client);

    Assert.assertEquals(909248813, result.intValue());

    client = this.cache.getClient(result);

    Assert.assertNotNull(client);
    Assert.assertEquals("xxx", client.getGadgetUri());
    Assert.assertEquals("yyy", client.getServiceName());
  }
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.