Ejemplo n.º 1
0
  @Override
  public ServerAuthorizationCodeGrant createCodeGrant(final AuthorizationCodeRegistration acr)
      throws OAuthServiceException {

    grant = new ServerAuthorizationCodeGrant(client, 3600L);
    grant.setRedirectUri(acr.getRedirectUri());
    grant.setSubject(acr.getSubject());
    final List<String> scope =
        acr.getApprovedScope().isEmpty() ? acr.getRequestedScope() : acr.getApprovedScope();
    grant.setApprovedScopes(scope);

    return grant;
  }
Ejemplo n.º 2
0
 private static ServerAuthorizationCodeGrant recreateCodeGrantInternal(
     OAuthDataProvider provider, String sequence) {
   String[] parts = getParts(sequence);
   ServerAuthorizationCodeGrant grant =
       new ServerAuthorizationCodeGrant(
           provider.getClient(parts[0]), parts[1], Long.valueOf(parts[2]), Long.valueOf(parts[3]));
   grant.setRedirectUri(getStringPart(parts[4]));
   grant.setAudience(getStringPart(parts[5]));
   grant.setClientCodeVerifier(getStringPart(parts[6]));
   grant.setApprovedScopes(parseSimpleList(parts[7]));
   grant.setSubject(recreateUserSubject(parts[8]));
   return grant;
 }