All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.clouway.oauth2.BearerTokenResponse Maven / Gradle / Ivy

There is a newer version: 1.0.6
Show newest version
package com.clouway.oauth2;

import com.clouway.oauth2.http.RsJson;
import com.clouway.oauth2.http.RsWrap;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;

/**
 * BearerTokenResponse is representing the response which is returned by the OAuth Server when token is generated.
 * 

* Bearer Token Usage is described in RFC6750 * * @author Miroslav Genov ([email protected]) */ public class BearerTokenResponse extends RsWrap { public BearerTokenResponse(String accessToken, Long expiresInSeconds, String refreshToken) { super(new RsJson(createToken(accessToken, expiresInSeconds, refreshToken) )); } private static JsonElement createToken(String accessToken, Long expiresInSeconds, String refreshToken) { JsonObject o = new JsonObject(); o.addProperty("access_token", accessToken); o.addProperty("token_type", "Bearer"); o.addProperty("expires_in", expiresInSeconds); o.addProperty("refresh_token", refreshToken); return o; } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy