Examples of AuthorizationCode


Examples of com.nimbusds.oauth2.sdk.AuthorizationCode

  public void testParseSuccess()
    throws Exception {

    URI redirectURI = new URI("https://example.com/in");
    AuthorizationCode code = new AuthorizationCode("123");
    State state = new State("xyz");

    AuthenticationSuccessResponse successResponse = new AuthenticationSuccessResponse(redirectURI, code, null, null, state);

    HTTPResponse httpResponse = successResponse.toHTTPResponse();
View Full Code Here

Examples of com.nimbusds.oauth2.sdk.AuthorizationCode


  public void testCodeIDTokenResponse()
    throws Exception {

    AuthorizationCode code = new AuthorizationCode();

    JWTClaimsSet claimsSet = new JWTClaimsSet();
    claimsSet.setIssuer("https://c2id.com");
    claimsSet.setAudience(Arrays.asList("https://client.com"));
    claimsSet.setSubject("alice");
View Full Code Here

Examples of com.nimbusds.oauth2.sdk.AuthorizationCode


  public void testCodeResponse()
    throws Exception {

    AuthorizationCode code = new AuthorizationCode();

    AuthenticationSuccessResponse response = new AuthenticationSuccessResponse(
      REDIRECT_URI, code, null, null, new State("abc"));

    assertEquals(REDIRECT_URI, response.getRedirectionURI());
View Full Code Here

Examples of com.nimbusds.oauth2.sdk.AuthorizationCode

public class CodeHashTest extends TestCase {


  public void testComputeAgainstSpecExample() {

    AuthorizationCode code = new AuthorizationCode("Qcb0Orv1zh30vL1MPRsbm-diHiMwcLyZvn1arpZv-Jxf_11jnpEX3Tgfvk");

    CodeHash computedHash = CodeHash.compute(code, JWSAlgorithm.RS256);

    CodeHash expectedHash = new CodeHash("LDktKdoQak3Pk0cnXxCltA");
View Full Code Here

Examples of com.nimbusds.oauth2.sdk.AuthorizationCode

  }


  public void testEquality() {

    AuthorizationCode code = new AuthorizationCode();

    CodeHash hash1 = CodeHash.compute(code, JWSAlgorithm.HS512);

    CodeHash hash2 = CodeHash.compute(code, JWSAlgorithm.HS512);
View Full Code Here

Examples of com.nimbusds.oauth2.sdk.AuthorizationCode

  }


  public void testUnsupportedJWSAlg() {

    AuthorizationCode code = new AuthorizationCode();

    assertNull(CodeHash.compute(code, new JWSAlgorithm("no-such-alg")));
  }
View Full Code Here

Examples of org.fluxtream.core.domain.oauth2.AuthorizationCode

    }

    @Override
    @Transactional(readOnly=false)
    public AuthorizationCode issueAuthorizationCode(final Long id, final Set<String> scopes, final String state) {
        AuthorizationCode code = new AuthorizationCode(id, scopes, state);
        em.persist(code);
        return code;
    }
View Full Code Here

Examples of org.fluxtream.core.domain.oauth2.AuthorizationCode

        return null;
    }

    @Override
    public AuthorizationCodeResponse getResponse(final String code) {
        AuthorizationCode authCode = getCode(code);
        if (authCode==null)
            return null;
        final TypedQuery<AuthorizationCodeResponse> query = em.createQuery(
                "SELECT authorizationCodeResponse FROM AuthorizationCodeResponse authorizationCodeResponse " +
                "WHERE authorizationCodeResponse.authorizationCodeId=?", AuthorizationCodeResponse.class);
        query.setParameter(1, authCode.getId());
        final List<AuthorizationCodeResponse> resultList = query.getResultList();
        if (resultList.size()>0)
            return resultList.get(0);
        return null;
    }
View Full Code Here

Examples of org.fluxtream.core.domain.oauth2.AuthorizationCode

    @Override
    @Transactional(readOnly=false)
    public AuthorizationToken issueAuthorizationToken(long guestId, long applicationId)
    {
        AuthorizationCode code = new AuthorizationCode(guestId, null, null);
        code.applicationId = applicationId;
        em.persist(code);
        AuthorizationToken token = new AuthorizationToken(guestId);
        token.authorizationCodeId = code.getId();
        em.persist(token);
        return token;
    }
View Full Code Here

Examples of org.fluxtream.core.domain.oauth2.AuthorizationCode

                        "WHERE authorizationToken.guestId=?", AuthorizationToken.class);
        query.setParameter(1, guestId);
        final List<AuthorizationToken> resultList = query.getResultList();
        final List<AuthorizationTokenModel> tokenModels = new ArrayList<AuthorizationTokenModel>();
        for (AuthorizationToken authorizationToken : resultList) {
            AuthorizationCode authCode = em.find(AuthorizationCode.class, authorizationToken.authorizationCodeId);
            Application application = em.find(Application.class, authCode.applicationId);
            AuthorizationTokenModel tokenModel = new AuthorizationTokenModel(authorizationToken.accessToken,
                    application.name, application.organization, application.website, authCode.creationTime);
            tokenModels.add(tokenModel);
        }
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.