|
1 | 1 | /*
|
2 |
| - * Copyright 2002-2020 the original author or authors. |
| 2 | + * Copyright 2002-2025 the original author or authors. |
3 | 3 | *
|
4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License");
|
5 | 5 | * you may not use this file except in compliance with the License.
|
@@ -115,6 +115,24 @@ public void getBuilderWhenOktaShouldHaveOktaSettings() {
|
115 | 115 | assertThat(registration.getRegistrationId()).isEqualTo("123");
|
116 | 116 | }
|
117 | 117 |
|
| 118 | + @Test |
| 119 | + public void getBuilderWhenXShouldHaveXSettings() { |
| 120 | + ClientRegistration registration = build(CommonOAuth2Provider.X); |
| 121 | + ProviderDetails providerDetails = registration.getProviderDetails(); |
| 122 | + assertThat(providerDetails.getAuthorizationUri()).isEqualTo("https://x.com/i/oauth2/authorize"); |
| 123 | + assertThat(providerDetails.getTokenUri()).isEqualTo("https://api.x.com/2/oauth2/token"); |
| 124 | + assertThat(providerDetails.getUserInfoEndpoint().getUri()).isEqualTo("https://api.x.com/2/users/me"); |
| 125 | + assertThat(providerDetails.getUserInfoEndpoint().getUserNameAttributeName()).isEqualTo("username"); |
| 126 | + assertThat(providerDetails.getJwkSetUri()).isNull(); |
| 127 | + assertThat(registration.getClientAuthenticationMethod()) |
| 128 | + .isEqualTo(ClientAuthenticationMethod.CLIENT_SECRET_POST); |
| 129 | + assertThat(registration.getAuthorizationGrantType()).isEqualTo(AuthorizationGrantType.AUTHORIZATION_CODE); |
| 130 | + assertThat(registration.getRedirectUri()).isEqualTo(DEFAULT_REDIRECT_URL); |
| 131 | + assertThat(registration.getScopes()).containsOnly("users.read", "tweet.read"); |
| 132 | + assertThat(registration.getClientName()).isEqualTo("X"); |
| 133 | + assertThat(registration.getRegistrationId()).isEqualTo("123"); |
| 134 | + } |
| 135 | + |
118 | 136 | private ClientRegistration build(CommonOAuth2Provider provider) {
|
119 | 137 | return builder(provider).build();
|
120 | 138 | }
|
|
0 commit comments