Skip to content

Commit b17a7f4

Browse files
committed
removed structured scopes
1 parent 524794f commit b17a7f4

File tree

21 files changed

+39
-278
lines changed

21 files changed

+39
-278
lines changed

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

Lines changed: 1 addition & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,6 @@ public class SystemScope {
5353
private String icon; // class of the icon to display on the auth page
5454
private boolean defaultScope = false; // is this a default scope for newly-registered clients?
5555
private boolean restricted = false; // is this scope restricted to admin-only registration access?
56-
private boolean structured = false; // is this a default scope for newly-registered clients?
57-
private String structuredParamDescription;
58-
private String structuredValue;
5956

6057
/**
6158
* Make a blank system scope with no value
@@ -162,52 +159,6 @@ public void setRestricted(boolean restricted) {
162159
this.restricted = restricted;
163160
}
164161

165-
/**
166-
* @return the isStructured status
167-
*/
168-
@Basic
169-
@Column(name = "structured")
170-
public boolean isStructured() {
171-
return structured;
172-
}
173-
174-
/**
175-
* @param structured the structured to set
176-
*/
177-
public void setStructured(boolean structured) {
178-
this.structured = structured;
179-
}
180-
181-
@Basic
182-
@Column(name = "structured_param_description")
183-
public String getStructuredParamDescription() {
184-
return structuredParamDescription;
185-
}
186-
187-
/**
188-
* @param isStructured the isStructured to set
189-
*/
190-
public void setStructuredParamDescription(String d) {
191-
this.structuredParamDescription = d;
192-
}
193-
194-
195-
/**
196-
* @return the structuredValue
197-
*/
198-
@Transient // we don't save the value of a system scope separately
199-
public String getStructuredValue() {
200-
return structuredValue;
201-
}
202-
203-
/**
204-
* @param structuredValue the structuredValue to set
205-
*/
206-
public void setStructuredValue(String structuredValue) {
207-
this.structuredValue = structuredValue;
208-
}
209-
210-
211162
/* (non-Javadoc)
212163
* @see java.lang.Object#hashCode()
213164
*/
@@ -221,13 +172,6 @@ public int hashCode() {
221172
result = prime * result + ((icon == null) ? 0 : icon.hashCode());
222173
result = prime * result + ((id == null) ? 0 : id.hashCode());
223174
result = prime * result + (restricted ? 1231 : 1237);
224-
result = prime * result + (structured ? 1231 : 1237);
225-
result = prime
226-
* result
227-
+ ((structuredParamDescription == null) ? 0
228-
: structuredParamDescription.hashCode());
229-
result = prime * result
230-
+ ((structuredValue == null) ? 0 : structuredValue.hashCode());
231175
result = prime * result + ((value == null) ? 0 : value.hashCode());
232176
return result;
233177
}
@@ -274,24 +218,6 @@ public boolean equals(Object obj) {
274218
if (restricted != other.restricted) {
275219
return false;
276220
}
277-
if (structured != other.structured) {
278-
return false;
279-
}
280-
if (structuredParamDescription == null) {
281-
if (other.structuredParamDescription != null) {
282-
return false;
283-
}
284-
} else if (!structuredParamDescription
285-
.equals(other.structuredParamDescription)) {
286-
return false;
287-
}
288-
if (structuredValue == null) {
289-
if (other.structuredValue != null) {
290-
return false;
291-
}
292-
} else if (!structuredValue.equals(other.structuredValue)) {
293-
return false;
294-
}
295221
if (value == null) {
296222
if (other.value != null) {
297223
return false;
@@ -309,10 +235,7 @@ public boolean equals(Object obj) {
309235
public String toString() {
310236
return "SystemScope [id=" + id + ", value=" + value + ", description="
311237
+ description + ", icon=" + icon + ", defaultScope="
312-
+ defaultScope + ", restricted=" + restricted + ", structured="
313-
+ structured + ", structuredParamDescription="
314-
+ structuredParamDescription + ", structuredValue="
315-
+ structuredValue + "]";
238+
+ defaultScope + ", restricted=" + restricted + "]";
316239
}
317240

318241
}

openid-connect-common/src/main/java/org/mitre/oauth2/service/SystemScopeService.java

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -96,12 +96,7 @@ public interface SystemScopeService {
9696
public Set<String> toStrings(Set<SystemScope> scope);
9797

9898
/**
99-
* Test whether the scopes in both sets are compatible, with special
100-
* processing for structured scopes. All scopes in "actual" must exist in
101-
* "expected". If a scope in "expected" is structured and has a value, it
102-
* must be matched exactly by its corresponding scope in "actual". If a
103-
* scope in "expected" is structured but has no value, it may be matched by
104-
* a scope with or without a value in "actual".
99+
* Test whether the scopes in both sets are compatible. All scopes in "actual" must exist in "expected".
105100
*/
106101
public boolean scopesMatch(Set<String> expected, Set<String> actual);
107102

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ CREATE TABLE IF NOT EXISTS access_token (
1010
refresh_token_id BIGINT,
1111
client_id BIGINT,
1212
auth_holder_id BIGINT,
13-
approved_site_id BIGINT
13+
approved_site_id BIGINT,
14+
UNIQUE(token_value)
1415
);
1516

1617
CREATE TABLE IF NOT EXISTS access_token_permissions (
@@ -235,8 +236,6 @@ CREATE TABLE IF NOT EXISTS system_scope (
235236
icon VARCHAR(256),
236237
restricted BOOLEAN DEFAULT false NOT NULL,
237238
default_scope BOOLEAN DEFAULT false NOT NULL,
238-
structured BOOLEAN DEFAULT false NOT NULL,
239-
structured_param_description VARCHAR(256),
240239
UNIQUE (scope)
241240
);
242241

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,5 @@ CREATE TEMPORARY TABLE IF NOT EXISTS system_scope_TEMP (
6969
description VARCHAR(4096),
7070
icon VARCHAR(256),
7171
restricted BOOLEAN,
72-
default_scope BOOLEAN,
73-
structured BOOLEAN,
74-
structured_param_description VARCHAR(256)
72+
default_scope BOOLEAN
7573
);

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

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,23 +10,23 @@ START TRANSACTION;
1010
-- Insert scope information into the temporary tables.
1111
--
1212

13-
INSERT INTO system_scope_TEMP (scope, description, icon, restricted, default_scope, structured, structured_param_description) VALUES
14-
('openid', 'log in using your identity', 'user', false, true, false, null),
15-
('profile', 'basic profile information', 'list-alt', false, true, false, null),
16-
('email', 'email address', 'envelope', false, true, false, null),
17-
('address', 'physical address', 'home', false, true, false, null),
18-
('phone', 'telephone number', 'bell', false, true, false, null),
19-
('offline_access', 'offline access', 'time', false, false, false, null);
13+
INSERT INTO system_scope_TEMP (scope, description, icon, restricted, default_scope) VALUES
14+
('openid', 'log in using your identity', 'user', false, true),
15+
('profile', 'basic profile information', 'list-alt', false, true),
16+
('email', 'email address', 'envelope', false, true),
17+
('address', 'physical address', 'home', false, true),
18+
('phone', 'telephone number', 'bell', false, true),
19+
('offline_access', 'offline access', 'time', false, false);
2020

2121
--
2222
-- Merge the temporary scopes safely into the database. This is a two-step process to keep scopes from being created on every startup with a persistent store.
2323
--
2424

2525
MERGE INTO system_scope
26-
USING (SELECT scope, description, icon, restricted, default_scope, structured, structured_param_description FROM system_scope_TEMP) AS vals(scope, description, icon, restricted, default_scope, structured, structured_param_description)
26+
USING (SELECT scope, description, icon, restricted, default_scope FROM system_scope_TEMP) AS vals(scope, description, icon, restricted, default_scope)
2727
ON vals.scope = system_scope.scope
2828
WHEN NOT MATCHED THEN
29-
INSERT (scope, description, icon, restricted, default_scope, structured, structured_param_description) VALUES(vals.scope, vals.description, vals.icon, vals.restricted, vals.default_scope, vals.structured, vals.structured_param_description);
29+
INSERT (scope, description, icon, restricted, default_scope) VALUES(vals.scope, vals.description, vals.icon, vals.restricted, vals.default_scope);
3030

3131
COMMIT;
3232

openid-connect-server-webapp/src/main/webapp/WEB-INF/authz-config.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252

5353
<bean id="oauthAccessDeniedHandler" class="org.springframework.security.oauth2.provider.error.OAuth2AccessDeniedHandler" />
5454

55-
<bean id="oauthRequestValidator" class="org.mitre.oauth2.token.StructuredScopeAwareOAuth2RequestValidator" />
55+
<bean id="oauthRequestValidator" class="org.mitre.oauth2.token.ScopeServiceAwareOAuth2RequestValidator" />
5656

5757
<!-- Error page handler. -->
5858
<mvc:view-controller path="/error" view-name="error" />

openid-connect-server-webapp/src/main/webapp/WEB-INF/views/approve.jsp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -218,10 +218,6 @@
218218
</span>
219219
</c:if>
220220

221-
<c:if test="${ scope.structured }">
222-
<input name="scopeparam_${ fn:escapeXml(scope.value) }" type="text" value="${ fn:escapeXml(scope.structuredValue) }" placeholder="${ fn:escapeXml(scope.structuredParamDescription) }">
223-
</c:if>
224-
225221
</label>
226222

227223
</c:forEach>

openid-connect-server-webapp/src/main/webapp/resources/js/locale/en/messages.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -306,9 +306,6 @@
306306
"icon": "Icon",
307307
"new": "New Scope",
308308
"select-icon": "Select an icon",
309-
"structured": "is a structured scope",
310-
"structured-help": "Is the scope structured with structured values like <code>base:extension</code>?",
311-
"structured-param-help": "Human-readable description of the structured parameter",
312309
"subject-type": "Subject Type",
313310
"value": "Scope value",
314311
"value-help": "Single string with no spaces",

openid-connect-server-webapp/src/main/webapp/resources/js/scope.js

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,7 @@ var SystemScopeModel = Backbone.Model.extend({
2323
icon:null,
2424
value:null,
2525
defaultScope:false,
26-
restricted:false,
27-
structured:false,
28-
structuredParamDescription:null,
29-
structuredValue:null
26+
restricted:false
3027
},
3128

3229
urlRoot: 'api/scopes'
@@ -267,8 +264,7 @@ var SystemScopeFormView = Backbone.View.extend({
267264
events:{
268265
'click .btn-save':'saveScope',
269266
'click .btn-cancel': function() {app.navigate('admin/scope', {trigger: true}); },
270-
'click .btn-icon':'selectIcon',
271-
'change #isStructured input':'toggleStructuredParamDescription'
267+
'click .btn-icon':'selectIcon'
272268
},
273269

274270
load:function(callback) {
@@ -290,14 +286,6 @@ var SystemScopeFormView = Backbone.View.extend({
290286

291287
},
292288

293-
toggleStructuredParamDescription:function(e) {
294-
if ($('#isStructured input', this.el).is(':checked')) {
295-
$('#structuredParamDescription', this.el).show();
296-
} else {
297-
$('#structuredParamDescription', this.el).hide();
298-
}
299-
},
300-
301289
saveScope:function(e) {
302290
e.preventDefault();
303291

@@ -313,9 +301,7 @@ var SystemScopeFormView = Backbone.View.extend({
313301
description:$('#description textarea').val(),
314302
icon:$('#iconDisplay input').val(),
315303
defaultScope:$('#defaultScope input').is(':checked'),
316-
restricted:$('#restricted input').is(':checked'),
317-
structured:$('#isStructured input').is(':checked'),
318-
structuredParamDescription:$('#structuredParamDescription input').val()
304+
restricted:$('#restricted input').is(':checked')
319305
});
320306

321307
if (valid) {
@@ -356,7 +342,6 @@ var SystemScopeFormView = Backbone.View.extend({
356342
$("#iconSelector .modal-body", this.el).append(this.iconTemplate({items:items}));
357343
}, this);
358344

359-
this.toggleStructuredParamDescription();
360345
$(this.el).i18n();
361346
return this;
362347
}

openid-connect-server-webapp/src/main/webapp/resources/template/scope.html

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -155,19 +155,6 @@ <h3 id="iconSelectorLabel" data-i18n="scope.system-scope-form.select-icon">Selec
155155
</div>
156156
</div>
157157

158-
<div class="control-group">
159-
<div class="controls" id="isStructured">
160-
<label class="checkbox">
161-
<input type="checkbox" <%-structured ? 'checked' : '' %>> <span data-i18n="scope.system-scope-form.structured">is a structured scope</span>
162-
</label>
163-
<p class="help-block" data-i18n="[html]scope.system-scope-form.structured-help">Is the scope structured with structured values like <code>base:extension</code>?</p>
164-
</div>
165-
<div class="controls" id="structuredParamDescription">
166-
<input type="text" value="<%-structuredParamDescription ? structuredParamDescription : '' %>">
167-
<p class="help-block" data-i18n="scope.system-scope-form.structured-param-help">Human-readable description of the structured parameter</p>
168-
</div>
169-
</div>
170-
171158
<div class="well well-small">
172159
<button class="btn btn-small btn-save btn-success"><i class="icon-ok-circle icon-white"></i> <span data-i18n="common.save">Save</span></button> &nbsp;
173160
<button class="btn btn-small btn-cancel"><i class="icon-ban-circle"></i> <span data-i18n="common.cancel">Cancel</span></button>

0 commit comments

Comments
 (0)