Package org.pac4j.oauth.credentials

Examples of org.pac4j.oauth.credentials.OAuthCredentials


      assertEquals("No credential found", e.getMessage());
    }
  }

  public void testOk() throws RequiresHttpAction {
    final OAuthCredentials oauthCredential = (OAuthCredentials) getClient().getCredentials(
        MockWebContext.create().addRequestParameter(BaseOAuth20Client.OAUTH_CODE, CODE));
    assertNotNull(oauthCredential);
    assertEquals(CODE, oauthCredential.getVerifier());
  }
View Full Code Here


            assertEquals("No credential found", e.getMessage());
        }
    }
   
    public void testOk() throws RequiresHttpAction {
        final OAuthCredentials credentials = (OAuthCredentials) getClient()
            .getCredentials(MockWebContext
                                .create()
                                .addRequestParameter(BaseOAuth10Client.OAUTH_VERIFIER, VERIFIER)
                                .addRequestParameter(BaseOAuth10Client.OAUTH_TOKEN, TOKEN)
                                .addSessionAttribute(getClient().getName() + "#" + BaseOAuth10Client.REQUEST_TOKEN,
                                                     new Token(TOKEN, SECRET)));
        assertNotNull(credentials);
        assertEquals(TOKEN, credentials.getToken());
        assertEquals(VERIFIER, credentials.getVerifier());
        final Token tokenRequest = credentials.getRequestToken();
        assertEquals(TOKEN, tokenRequest.getToken());
        assertEquals(SECRET, tokenRequest.getSecret());
    }
View Full Code Here

            assertEquals("No credential found", e.getMessage());
        }
    }
   
    public void testOk() throws RequiresHttpAction {
        final OAuthCredentials oauthCredential = (OAuthCredentials) getClient()
            .getCredentials(MockWebContext.create().addRequestParameter(BaseOAuth20Client.OAUTH_CODE, CODE));
        assertNotNull(oauthCredential);
        assertEquals(CODE, oauthCredential.getVerifier());
    }
View Full Code Here

        final String verifierParameter = context.getRequestParameter(OAUTH_CODE);
        if (verifierParameter != null) {
            final String verifier = OAuthEncoder.decode(verifierParameter);
            logger.debug("verifier : {}", verifier);
            return new OAuthCredentials(verifier, getName());
        } else {
            final String message = "No credential found";
            logger.error(message);
            throw new OAuthCredentialsException(message);
        }
View Full Code Here

        logger.debug("tokenRequest : {}", tokenRequest);
        // don't get parameters from url
        // token and verifier are equals and extracted from saved request token
        final String token = tokenRequest.getToken();
        logger.debug("token = verifier : {}", token);
        return new OAuthCredentials(tokenRequest, token, token, getName());
    }
View Full Code Here

            final Token tokenSession = (Token) context.getSessionAttribute(getRequestTokenSessionAttributeName());
            logger.debug("tokenRequest : {}", tokenSession);
            final String token = OAuthEncoder.decode(tokenParameter);
            final String verifier = OAuthEncoder.decode(verifierParameter);
            logger.debug("token : {} / verifier : {}", token, verifier);
            return new OAuthCredentials(tokenSession, token, verifier, getName());
        } else {
            final String message = "No credential found";
            logger.error(message);
            throw new OAuthCredentialsException(message);
        }
View Full Code Here

TOP

Related Classes of org.pac4j.oauth.credentials.OAuthCredentials

Copyright © 2018 www.massapicom. 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.