dynamic scope display/selection on approval page
parent
1281d75aa9
commit
667c3abc8a
|
@ -18,6 +18,7 @@
|
||||||
*/
|
*/
|
||||||
package org.mitre.oauth2.web;
|
package org.mitre.oauth2.web;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.mitre.oauth2.exception.ClientNotFoundException;
|
import org.mitre.oauth2.exception.ClientNotFoundException;
|
||||||
|
@ -71,6 +72,12 @@ public class OAuthConfirmationController {
|
||||||
|
|
||||||
model.put("redirect_uri", redirect_uri);
|
model.put("redirect_uri", redirect_uri);
|
||||||
|
|
||||||
|
Map<String, Boolean> scopes = new HashMap<String, Boolean>();
|
||||||
|
for (String scope : clientAuth.getScope()) {
|
||||||
|
scopes.put(scope, Boolean.TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
|
model.put("scopes", scopes);
|
||||||
|
|
||||||
return new ModelAndView("oauth/approve", model);
|
return new ModelAndView("oauth/approve", model);
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,17 +74,28 @@
|
||||||
<div class="span4">
|
<div class="span4">
|
||||||
<fieldset style="text-align:left" class="well">
|
<fieldset style="text-align:left" class="well">
|
||||||
<legend style="margin-bottom: 0;">Access to:</legend>
|
<legend style="margin-bottom: 0;">Access to:</legend>
|
||||||
|
|
||||||
<input type="hidden" name="scope_openid" id="scope_openid" value="openid"/>
|
<input type="hidden" name="scope_openid" id="scope_openid" value="openid"/>
|
||||||
<input type="checkbox" name="scope_profile" id="scope_profile" value="profile" checked="checked"><label for="scope_profile">basic profile information</label>
|
|
||||||
|
|
||||||
<input type="checkbox" name="scope_email" id="scope_email" value="email" checked="checked"><label for="scope_email">email address</label>
|
<c:if test="${not empty scopes['profile']}">
|
||||||
|
<input type="checkbox" name="scope_profile" id="scope_profile" value="profile" checked="checked"><label for="scope_profile"><i class="icon-list-alt"></i> basic profile information</label>
|
||||||
|
</c:if>
|
||||||
|
|
||||||
|
<c:if test="${not empty scopes['email']}">
|
||||||
|
<input type="checkbox" name="scope_email" id="scope_email" value="email" checked="checked"><label for="scope_email"><i class="icon-envelope"></i> email address</label>
|
||||||
|
</c:if>
|
||||||
|
|
||||||
<input type="checkbox" name="scope_address" id="scope_address" value="address" checked="checked"><label for="scope_address">address</label>
|
<c:if test="${not empty scopes['address']}">
|
||||||
|
<input type="checkbox" name="scope_address" id="scope_address" value="address" checked="checked"><label for="scope_address"><i class="icon-home"></i> address</label>
|
||||||
|
</c:if>
|
||||||
|
|
||||||
<input type="checkbox" name="scope_phone" id="scope_phone" value="phone" checked="checked"><label for="scope_phone">phone number</label>
|
<c:if test="${not empty scopes['phone']}">
|
||||||
|
<input type="checkbox" name="scope_phone" id="scope_phone" value="phone" checked="checked"><label for="scope_phone"><i class="icon-bell"></i> phone number</label>
|
||||||
|
</c:if>
|
||||||
|
|
||||||
<input type="checkbox" name="scope_offline" id="scope_offline" value="offline" checked="checked"><label for="scope_offline">offline access</label>
|
<c:if test="${not empty scopes['offline']}">
|
||||||
|
<input type="checkbox" name="scope_offline" id="scope_offline" value="offline" checked="checked"><label for="scope_offline"><i class="icon-time"></i> offline access</label>
|
||||||
|
</c:if>
|
||||||
|
|
||||||
<input type="checkbox" name="remember" id="remember" value="true" checked="checked"><label for="remember">remember this decision</label>
|
<input type="checkbox" name="remember" id="remember" value="true" checked="checked"><label for="remember">remember this decision</label>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue