gluu
静的公開メンバ関数 | 静的非公開メンバ関数 | 静的非公開変数類 | 全メンバ一覧
org.xdi.oxd.server.manual.GoogleTest クラス
org.xdi.oxd.server.manual.GoogleTest 連携図
Collaboration graph

静的公開メンバ関数

static void main (String[] args) throws IOException
 
static RegisterSiteResponse registerSite (ClientInterface client)
 

静的非公開メンバ関数

static String getAuthorizationUrl (ClientInterface client, String oxdId)
 

静的非公開変数類

static final String HOST = "http://localhost:8084"
 
static final String OP_HOST = "https://accounts.google.com"
 
static final String REDIRECT_URI = "https://mytestproduct.com"
 
static final String CLIENT_ID = "470707636610-pr4nn6dr82the6kuktqfr7lq4g7n9rb1.apps.googleusercontent.com"
 
static final String CLIENT_SECRET = "vJVYPI4Ybwc9a2YOesq2bRCa"
 

詳解

著者
Yuriy Zabrovarnyy
バージョン
0.9, 25/08/2016

関数詳解

◆ getAuthorizationUrl()

static String org.xdi.oxd.server.manual.GoogleTest.getAuthorizationUrl ( ClientInterface  client,
String  oxdId 
)
inlinestaticprivate
54  {
55  final GetAuthorizationUrlParams params = new GetAuthorizationUrlParams();
56  params.setOxdId(oxdId);
57 
58  final GetAuthorizationUrlResponse resp = client.getAuthorizationUrl(Tester.getAuthorization(), params).dataAsResponse(GetAuthorizationUrlResponse.class);
59  assertNotNull(resp);
60  notEmpty(resp.getAuthorizationUrl());
61  System.out.println("Authorization url: " + resp.getAuthorizationUrl());
62  return resp.getAuthorizationUrl();
63  }

◆ main()

static void org.xdi.oxd.server.manual.GoogleTest.main ( String []  args) throws IOException
inlinestatic
34  {
35  ClientInterface client = Tester.newClient(HOST);
36 
37  final RegisterSiteResponse site = registerSite(client);
38  final String authorizationUrl = getAuthorizationUrl(client, site.getOxdId());
39 
40  // after successful login get redirect with code
41  // https://mytestproduct.com/?state=af0ifjsldkj&code=4/2I5U130cxs7MObKVniVseBQkHQ0JQS0p5JfZm7NgZ-M&authuser=0&session_state=02bd0461002924877bee444d9dfd9f1279e44335..ae63&prompt=consent#
42 // String code = "4/2I5U130cxs7MObKVniVseBQkHQ0JQS0p5JfZm7NgZ-M";
43 // String code = "4/e8WrOQDMNRllHvMGAEKAovwWMnIy7k7oxRN4Xn9JPrg";
44  String code = "4/nWqDxBS-c7MDN_1Gq2WtW2L6B9KnA5rpOOYzGEdg7lM";
45 
46  final GetTokensByCodeParams params = new GetTokensByCodeParams();
47  params.setOxdId(site.getOxdId());
48  params.setCode(code);
49 
50  final GetTokensByCodeResponse resp = client.getTokenByCode(Tester.getAuthorization(), params).dataAsResponse(GetTokensByCodeResponse.class);
51  System.out.println(resp);
52  }
static RegisterSiteResponse registerSite(ClientInterface client)
Definition: GoogleTest.java:65
static String getAuthorizationUrl(ClientInterface client, String oxdId)
Definition: GoogleTest.java:54
static final String HOST
Definition: GoogleTest.java:26

◆ registerSite()

static RegisterSiteResponse org.xdi.oxd.server.manual.GoogleTest.registerSite ( ClientInterface  client)
inlinestatic
65  {
66 
67  final RegisterSiteParams params = new RegisterSiteParams();
68  params.setOpHost(OP_HOST);
69  params.setAuthorizationRedirectUri(REDIRECT_URI);
70  params.setClientId(CLIENT_ID);
71  params.setClientSecret(CLIENT_SECRET);
72 
73  final RegisterSiteResponse resp = client.registerSite(Tester.getAuthorization(), params).dataAsResponse(RegisterSiteResponse.class);
74  assertNotNull(resp);
75  assertTrue(!Strings.isNullOrEmpty(resp.getOxdId()));
76  return resp;
77  }
static final String CLIENT_SECRET
Definition: GoogleTest.java:32
static final String REDIRECT_URI
Definition: GoogleTest.java:29
static final String CLIENT_ID
Definition: GoogleTest.java:31
static final String OP_HOST
Definition: GoogleTest.java:28

メンバ詳解

◆ CLIENT_ID

final String org.xdi.oxd.server.manual.GoogleTest.CLIENT_ID = "470707636610-pr4nn6dr82the6kuktqfr7lq4g7n9rb1.apps.googleusercontent.com"
staticprivate

◆ CLIENT_SECRET

final String org.xdi.oxd.server.manual.GoogleTest.CLIENT_SECRET = "vJVYPI4Ybwc9a2YOesq2bRCa"
staticprivate

◆ HOST

final String org.xdi.oxd.server.manual.GoogleTest.HOST = "http://localhost:8084"
staticprivate

◆ OP_HOST

final String org.xdi.oxd.server.manual.GoogleTest.OP_HOST = "https://accounts.google.com"
staticprivate

◆ REDIRECT_URI

final String org.xdi.oxd.server.manual.GoogleTest.REDIRECT_URI = "https://mytestproduct.com"
staticprivate

このクラス詳解は次のファイルから抽出されました: