mitreid-connect
公開メンバ関数 | 全メンバ一覧
org.mitre.oauth2.model.RegisteredClientTest クラス
org.mitre.oauth2.model.RegisteredClientTest 連携図
Collaboration graph

公開メンバ関数

void testRegisteredClient ()
 
void testRegisteredClientClientDetailsEntity ()
 
void testRegisteredClientClientDetailsEntityStringString ()
 

詳解

著者
jricher

関数詳解

◆ testRegisteredClient()

void org.mitre.oauth2.model.RegisteredClientTest.testRegisteredClient ( )
inline

Test method for org.mitre.oauth2.model.RegisteredClient#RegisteredClient().

43  {
44 
45  // make sure all the pass-through getters and setters work
46 
47  RegisteredClient c = new RegisteredClient();
48 
49  c.setClientId("s6BhdRkqt3");
50  c.setClientSecret("ZJYCqe3GGRvdrudKyZS0XhGv_Z45DuKhCUk0gBR1vZk");
51  c.setClientSecretExpiresAt(new Date(1577858400L * 1000L));
52  c.setRegistrationAccessToken("this.is.an.access.token.value.ffx83");
53  c.setRegistrationClientUri("https://server.example.com/connect/register?client_id=s6BhdRkqt3");
54  c.setApplicationType(ClientDetailsEntity.AppType.WEB);
55  c.setRedirectUris(ImmutableSet.of("https://client.example.org/callback", "https://client.example.org/callback2"));
56  c.setClientName("My Example");
57  c.setLogoUri("https://client.example.org/logo.png");
58  c.setSubjectType(ClientDetailsEntity.SubjectType.PAIRWISE);
59  c.setSectorIdentifierUri("https://other.example.net/file_of_redirect_uris.json");
60  c.setTokenEndpointAuthMethod(ClientDetailsEntity.AuthMethod.SECRET_BASIC);
61  c.setJwksUri("https://client.example.org/my_public_keys.jwks");
62  c.setUserInfoEncryptedResponseAlg(JWEAlgorithm.RSA1_5);
63  c.setUserInfoEncryptedResponseEnc(EncryptionMethod.A128CBC_HS256);
64  c.setContacts(ImmutableSet.of("ve7jtb@example.org", "mary@example.org"));
65  c.setRequestUris(ImmutableSet.of("https://client.example.org/rf.txt#qpXaRLh_n93TTR9F252ValdatUQvQiJi5BDub2BeznA"));
66 
67  assertEquals("s6BhdRkqt3", c.getClientId());
68  assertEquals("ZJYCqe3GGRvdrudKyZS0XhGv_Z45DuKhCUk0gBR1vZk", c.getClientSecret());
69  assertEquals(new Date(1577858400L * 1000L), c.getClientSecretExpiresAt());
70  assertEquals("this.is.an.access.token.value.ffx83", c.getRegistrationAccessToken());
71  assertEquals("https://server.example.com/connect/register?client_id=s6BhdRkqt3", c.getRegistrationClientUri());
72  assertEquals(ClientDetailsEntity.AppType.WEB, c.getApplicationType());
73  assertEquals(ImmutableSet.of("https://client.example.org/callback", "https://client.example.org/callback2"), c.getRedirectUris());
74  assertEquals("My Example", c.getClientName());
75  assertEquals("https://client.example.org/logo.png", c.getLogoUri());
76  assertEquals(ClientDetailsEntity.SubjectType.PAIRWISE, c.getSubjectType());
77  assertEquals("https://other.example.net/file_of_redirect_uris.json", c.getSectorIdentifierUri());
78  assertEquals(ClientDetailsEntity.AuthMethod.SECRET_BASIC, c.getTokenEndpointAuthMethod());
79  assertEquals("https://client.example.org/my_public_keys.jwks", c.getJwksUri());
80  assertEquals(JWEAlgorithm.RSA1_5, c.getUserInfoEncryptedResponseAlg());
81  assertEquals(EncryptionMethod.A128CBC_HS256, c.getUserInfoEncryptedResponseEnc());
82  assertEquals(ImmutableSet.of("ve7jtb@example.org", "mary@example.org"), c.getContacts());
83  assertEquals(ImmutableSet.of("https://client.example.org/rf.txt#qpXaRLh_n93TTR9F252ValdatUQvQiJi5BDub2BeznA"), c.getRequestUris());
84  }

◆ testRegisteredClientClientDetailsEntity()

void org.mitre.oauth2.model.RegisteredClientTest.testRegisteredClientClientDetailsEntity ( )
inline

Test method for org.mitre.oauth2.model.RegisteredClient#RegisteredClient(org.mitre.oauth2.model.ClientDetailsEntity).

90  {
91  ClientDetailsEntity c = new ClientDetailsEntity();
92 
93  c.setClientId("s6BhdRkqt3");
94  c.setClientSecret("ZJYCqe3GGRvdrudKyZS0XhGv_Z45DuKhCUk0gBR1vZk");
95  c.setApplicationType(ClientDetailsEntity.AppType.WEB);
96  c.setRedirectUris(ImmutableSet.of("https://client.example.org/callback", "https://client.example.org/callback2"));
97  c.setClientName("My Example");
98  c.setLogoUri("https://client.example.org/logo.png");
99  c.setSubjectType(ClientDetailsEntity.SubjectType.PAIRWISE);
100  c.setSectorIdentifierUri("https://other.example.net/file_of_redirect_uris.json");
101  c.setTokenEndpointAuthMethod(ClientDetailsEntity.AuthMethod.SECRET_BASIC);
102  c.setJwksUri("https://client.example.org/my_public_keys.jwks");
103  c.setUserInfoEncryptedResponseAlg(JWEAlgorithm.RSA1_5);
104  c.setUserInfoEncryptedResponseEnc(EncryptionMethod.A128CBC_HS256);
105  c.setContacts(ImmutableSet.of("ve7jtb@example.org", "mary@example.org"));
106  c.setRequestUris(ImmutableSet.of("https://client.example.org/rf.txt#qpXaRLh_n93TTR9F252ValdatUQvQiJi5BDub2BeznA"));
107 
108  // Create a RegisteredClient based on a ClientDetailsEntity object and set several properties
109  RegisteredClient rc = new RegisteredClient(c);
110  rc.setClientSecretExpiresAt(new Date(1577858400L * 1000L));
111  rc.setRegistrationAccessToken("this.is.an.access.token.value.ffx83");
112  rc.setRegistrationClientUri("https://server.example.com/connect/register?client_id=s6BhdRkqt3");
113 
114  // make sure all the pass-throughs work
115  assertEquals("s6BhdRkqt3", rc.getClientId());
116  assertEquals("ZJYCqe3GGRvdrudKyZS0XhGv_Z45DuKhCUk0gBR1vZk", rc.getClientSecret());
117  assertEquals(new Date(1577858400L * 1000L), rc.getClientSecretExpiresAt());
118  assertEquals("this.is.an.access.token.value.ffx83", rc.getRegistrationAccessToken());
119  assertEquals("https://server.example.com/connect/register?client_id=s6BhdRkqt3", rc.getRegistrationClientUri());
120  assertEquals(ClientDetailsEntity.AppType.WEB, rc.getApplicationType());
121  assertEquals(ImmutableSet.of("https://client.example.org/callback", "https://client.example.org/callback2"), rc.getRedirectUris());
122  assertEquals("My Example", rc.getClientName());
123  assertEquals("https://client.example.org/logo.png", rc.getLogoUri());
124  assertEquals(ClientDetailsEntity.SubjectType.PAIRWISE, rc.getSubjectType());
125  assertEquals("https://other.example.net/file_of_redirect_uris.json", rc.getSectorIdentifierUri());
126  assertEquals(ClientDetailsEntity.AuthMethod.SECRET_BASIC, rc.getTokenEndpointAuthMethod());
127  assertEquals("https://client.example.org/my_public_keys.jwks", rc.getJwksUri());
128  assertEquals(JWEAlgorithm.RSA1_5, rc.getUserInfoEncryptedResponseAlg());
129  assertEquals(EncryptionMethod.A128CBC_HS256, rc.getUserInfoEncryptedResponseEnc());
130  assertEquals(ImmutableSet.of("ve7jtb@example.org", "mary@example.org"), rc.getContacts());
131  assertEquals(ImmutableSet.of("https://client.example.org/rf.txt#qpXaRLh_n93TTR9F252ValdatUQvQiJi5BDub2BeznA"), rc.getRequestUris());
132  }

◆ testRegisteredClientClientDetailsEntityStringString()

void org.mitre.oauth2.model.RegisteredClientTest.testRegisteredClientClientDetailsEntityStringString ( )
inline

Test method for org.mitre.oauth2.model.RegisteredClient#RegisteredClient(org.mitre.oauth2.model.ClientDetailsEntity, java.lang.String, java.lang.String).

138  {
139  ClientDetailsEntity c = new ClientDetailsEntity();
140 
141  c.setClientId("s6BhdRkqt3");
142  c.setClientSecret("ZJYCqe3GGRvdrudKyZS0XhGv_Z45DuKhCUk0gBR1vZk");
143  c.setApplicationType(ClientDetailsEntity.AppType.WEB);
144  c.setRedirectUris(ImmutableSet.of("https://client.example.org/callback", "https://client.example.org/callback2"));
145  c.setClientName("My Example");
146  c.setLogoUri("https://client.example.org/logo.png");
147  c.setSubjectType(ClientDetailsEntity.SubjectType.PAIRWISE);
148  c.setSectorIdentifierUri("https://other.example.net/file_of_redirect_uris.json");
149  c.setTokenEndpointAuthMethod(ClientDetailsEntity.AuthMethod.SECRET_BASIC);
150  c.setJwksUri("https://client.example.org/my_public_keys.jwks");
151  c.setUserInfoEncryptedResponseAlg(JWEAlgorithm.RSA1_5);
152  c.setUserInfoEncryptedResponseEnc(EncryptionMethod.A128CBC_HS256);
153  c.setContacts(ImmutableSet.of("ve7jtb@example.org", "mary@example.org"));
154  c.setRequestUris(ImmutableSet.of("https://client.example.org/rf.txt#qpXaRLh_n93TTR9F252ValdatUQvQiJi5BDub2BeznA"));
155 
156  // Create a RegisteredClient based on a ClientDetails, a token, and a server URI
157  RegisteredClient rc = new RegisteredClient(c, "this.is.an.access.token.value.ffx83", "https://server.example.com/connect/register?client_id=s6BhdRkqt3");
158 
159  // make sure all the pass-throughs work
160  assertEquals("s6BhdRkqt3", rc.getClientId());
161  assertEquals("ZJYCqe3GGRvdrudKyZS0XhGv_Z45DuKhCUk0gBR1vZk", rc.getClientSecret());
162  assertEquals("this.is.an.access.token.value.ffx83", rc.getRegistrationAccessToken());
163  assertEquals("https://server.example.com/connect/register?client_id=s6BhdRkqt3", rc.getRegistrationClientUri());
164  assertEquals(ClientDetailsEntity.AppType.WEB, rc.getApplicationType());
165  assertEquals(ImmutableSet.of("https://client.example.org/callback", "https://client.example.org/callback2"), rc.getRedirectUris());
166  assertEquals("My Example", rc.getClientName());
167  assertEquals("https://client.example.org/logo.png", rc.getLogoUri());
168  assertEquals(ClientDetailsEntity.SubjectType.PAIRWISE, rc.getSubjectType());
169  assertEquals("https://other.example.net/file_of_redirect_uris.json", rc.getSectorIdentifierUri());
170  assertEquals(ClientDetailsEntity.AuthMethod.SECRET_BASIC, rc.getTokenEndpointAuthMethod());
171  assertEquals("https://client.example.org/my_public_keys.jwks", rc.getJwksUri());
172  assertEquals(JWEAlgorithm.RSA1_5, rc.getUserInfoEncryptedResponseAlg());
173  assertEquals(EncryptionMethod.A128CBC_HS256, rc.getUserInfoEncryptedResponseEnc());
174  assertEquals(ImmutableSet.of("ve7jtb@example.org", "mary@example.org"), rc.getContacts());
175  assertEquals(ImmutableSet.of("https://client.example.org/rf.txt#qpXaRLh_n93TTR9F252ValdatUQvQiJi5BDub2BeznA"), rc.getRequestUris());
176  }

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