Skip to content

Commit 7ad29ae

Browse files
committed
Revert "Add possibility to disable verification_uri_complete per client"
This reverts commit dae674a.
1 parent dae674a commit 7ad29ae

File tree

7 files changed

+7
-67
lines changed

7 files changed

+7
-67
lines changed

openid-connect-common/src/main/java/org/mitre/oauth2/model/ClientDetailsEntity.java

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,6 @@ public class ClientDetailsEntity implements ClientDetails {
148148
private Date createdAt; // time the client was created
149149
private boolean clearAccessTokensOnRefresh = true; // do we clear access tokens on refresh?
150150
private Integer deviceCodeValiditySeconds; // timeout for device codes
151-
private boolean verificationUriCompleteEnabled = true; // device code optional feature
152151

153152
/** fields for UMA */
154153
private Set<String> claimsRedirectUris;
@@ -1052,22 +1051,6 @@ public void setDeviceCodeValiditySeconds(Integer deviceCodeValiditySeconds) {
10521051
this.deviceCodeValiditySeconds = deviceCodeValiditySeconds;
10531052
}
10541053

1055-
/**
1056-
* @return true if verification uri complete in device code flow is enabled, false otherwise
1057-
*/
1058-
@Basic
1059-
@Column(name="verification_uri_complete_enabled")
1060-
public boolean isVerificationUriCompleteEnabled() {
1061-
return verificationUriCompleteEnabled;
1062-
}
1063-
1064-
/**
1065-
* @param verificationUriCompleteEnabled true/false to enable/disable verification uri complete functionality in device code flow
1066-
*/
1067-
public void setVerificationUriCompleteEnabled(boolean verificationUriCompleteEnabled) {
1068-
this.verificationUriCompleteEnabled = verificationUriCompleteEnabled;
1069-
}
1070-
10711054
/**
10721055
* @return the softwareId
10731056
*/

openid-connect-server-webapp/src/main/resources/db/hsql/hsql_database_tables.sql

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,6 @@ CREATE TABLE IF NOT EXISTS client_details (
132132
allow_introspection BOOLEAN DEFAULT false NOT NULL,
133133
id_token_validity_seconds BIGINT DEFAULT 600 NOT NULL,
134134
device_code_validity_seconds BIGINT,
135-
verification_uri_complete_enabled BOOLEAN DEFAULT true NOT NULL,
136135

137136
client_id VARCHAR(256),
138137
client_secret VARCHAR(2048),

openid-connect-server-webapp/src/main/resources/db/mysql/mysql_database_tables.sql

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,6 @@ CREATE TABLE IF NOT EXISTS client_details (
131131
allow_introspection BOOLEAN DEFAULT false NOT NULL,
132132
id_token_validity_seconds BIGINT DEFAULT 600 NOT NULL,
133133
device_code_validity_seconds BIGINT,
134-
verification_uri_complete_enabled BOOLEAN DEFAULT true NOT NULL,
135134

136135
client_id VARCHAR(256),
137136
client_secret VARCHAR(2048),

openid-connect-server-webapp/src/main/resources/db/oracle/oracle_database_tables.sql

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,6 @@ CREATE TABLE client_details (
147147
access_token_validity_seconds NUMBER(19),
148148
refresh_token_validity_seconds NUMBER(19),
149149
device_code_validity_seconds NUMBER(19),
150-
verification_uri_complete_enabled NUMBER(1) DEFAULT 1 NOT NULL,
151150

152151
application_type VARCHAR2(256),
153152
client_name VARCHAR2(256),

openid-connect-server-webapp/src/main/resources/db/psql/psql_database_tables.sql

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,6 @@ CREATE TABLE IF NOT EXISTS client_details (
132132
allow_introspection BOOLEAN DEFAULT false NOT NULL,
133133
id_token_validity_seconds BIGINT DEFAULT 600 NOT NULL,
134134
device_code_validity_seconds BIGINT,
135-
verification_uri_complete_enabled BOOLEAN DEFAULT true NOT NULL,
136135

137136
client_id VARCHAR(256),
138137
client_secret VARCHAR(2048),

openid-connect-server/src/main/java/org/mitre/oauth2/exception/CompleteVerificationUriDisabledException.java

Lines changed: 0 additions & 34 deletions
This file was deleted.

openid-connect-server/src/main/java/org/mitre/oauth2/web/DeviceEndpoint.java

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@
2424
import java.util.LinkedHashSet;
2525
import java.util.Map;
2626
import java.util.Set;
27+
import java.util.UUID;
2728

2829
import javax.servlet.http.HttpSession;
2930

3031
import org.apache.http.client.utils.URIBuilder;
31-
import org.mitre.oauth2.exception.CompleteVerificationUriDisabledException;
3232
import org.mitre.oauth2.exception.DeviceCodeCreationException;
3333
import org.mitre.oauth2.model.ClientDetailsEntity;
3434
import org.mitre.oauth2.model.DeviceCode;
@@ -50,6 +50,7 @@
5050
import org.springframework.security.core.Authentication;
5151
import org.springframework.security.oauth2.common.exceptions.InvalidClientException;
5252
import org.springframework.security.oauth2.common.util.OAuth2Utils;
53+
import org.springframework.security.oauth2.common.util.RandomValueStringGenerator;
5354
import org.springframework.security.oauth2.provider.AuthorizationRequest;
5455
import org.springframework.security.oauth2.provider.OAuth2Authentication;
5556
import org.springframework.security.oauth2.provider.OAuth2Request;
@@ -137,16 +138,15 @@ public String requestDeviceCode(@RequestParam("client_id") String clientId, @Req
137138
try {
138139
DeviceCode dc = deviceCodeService.createNewDeviceCode(requestedScopes, client, parameters);
139140

141+
URI verificationUriComplete = new URIBuilder(config.getIssuer() + USER_URL)
142+
.addParameter("user_code", dc.getUserCode())
143+
.build();
144+
140145
Map<String, Object> response = new HashMap<>();
141146
response.put("device_code", dc.getDeviceCode());
142147
response.put("user_code", dc.getUserCode());
143148
response.put("verification_uri", config.getIssuer() + USER_URL);
144-
if (client.isVerificationUriCompleteEnabled()) {
145-
URI verificationUriComplete = new URIBuilder(config.getIssuer() + USER_URL)
146-
.addParameter("user_code", dc.getUserCode())
147-
.build();
148-
response.put("verification_uri_complete", verificationUriComplete);
149-
}
149+
response.put("verification_uri_complete", verificationUriComplete);
150150
if (client.getDeviceCodeValiditySeconds() != null) {
151151
response.put("expires_in", client.getDeviceCodeValiditySeconds());
152152
}
@@ -185,7 +185,6 @@ public String requestUserCode(@RequestParam(value = "user_code", required = fals
185185
// complete verification uri was used, we received user code directly
186186
// skip requesting code page
187187
// user must be logged in
188-
model.addAttribute("completeVerificationUriUsed", true);
189188
return readUserCode(userCode, model, session);
190189
}
191190
}
@@ -217,10 +216,6 @@ public String readUserCode(@RequestParam("user_code") String userCode, ModelMap
217216

218217
ClientDetailsEntity client = clientService.loadClientByClientId(dc.getClientId());
219218

220-
if (!client.isVerificationUriCompleteEnabled() && Boolean.TRUE.equals(model.get("completeVerificationUriUsed"))) {
221-
throw new CompleteVerificationUriDisabledException(client.getClientId());
222-
}
223-
224219
model.put("client", client);
225220
model.put("dc", dc);
226221

0 commit comments

Comments
 (0)