extracted controller URLs to constants, closes #769

pull/803/head
Justin Richer 2015-03-11 13:20:59 -04:00
parent 617d485478
commit 1735dbca11
18 changed files with 85 additions and 42 deletions

View File

@ -32,7 +32,7 @@ import com.google.common.collect.Sets;
public interface SystemScopeService { public interface SystemScopeService {
public static final String OFFLINE_ACCESS = "offline_access"; public static final String OFFLINE_ACCESS = "offline_access";
public static final Object OPENID_SCOPE = "openid"; public static final String OPENID_SCOPE = "openid";
public static final String ID_TOKEN_SCOPE = "id-token"; public static final String ID_TOKEN_SCOPE = "id-token";
public static final String REGISTRATION_TOKEN_SCOPE = "registration-token"; public static final String REGISTRATION_TOKEN_SCOPE = "registration-token";
public static final String RESOURCE_TOKEN_SCOPE = "resource-token"; public static final String RESOURCE_TOKEN_SCOPE = "resource-token";

View File

@ -86,13 +86,13 @@
<security:access-denied-handler ref="oauthAccessDeniedHandler" /> <security:access-denied-handler ref="oauthAccessDeniedHandler" />
</security:http> </security:http>
<!-- Allow open access to required endpoints --> <!-- Allow open access to discovery endpoints -->
<security:http pattern="/jwk**" use-expressions="true" entry-point-ref="http403EntryPoint" create-session="stateless"> <security:http pattern="/#{T(org.mitre.openid.connect.web.JWKSetPublishingEndpoint).URL}**" use-expressions="true" entry-point-ref="http403EntryPoint" create-session="stateless">
<security:intercept-url pattern="/jwk**" access="permitAll"/> <security:intercept-url pattern="/#{T(org.mitre.openid.connect.web.JWKSetPublishingEndpoint).URL}**" access="permitAll"/>
<security:custom-filter ref="corsFilter" after="SECURITY_CONTEXT_FILTER" /> <security:custom-filter ref="corsFilter" after="SECURITY_CONTEXT_FILTER" />
</security:http> </security:http>
<security:http pattern="/.well-known/**" use-expressions="true" entry-point-ref="http403EntryPoint" create-session="stateless"> <security:http pattern="/#{T(org.mitre.discovery.web.DiscoveryEndpoint).WELL_KNOWN_URL}/**" use-expressions="true" entry-point-ref="http403EntryPoint" create-session="stateless">
<security:intercept-url pattern="/.well-known/**" access="permitAll"/> <security:intercept-url pattern="/#{T(org.mitre.discovery.web.DiscoveryEndpoint).WELL_KNOWN_URL}/**" access="permitAll"/>
<security:custom-filter ref="corsFilter" after="SECURITY_CONTEXT_FILTER" /> <security:custom-filter ref="corsFilter" after="SECURITY_CONTEXT_FILTER" />
</security:http> </security:http>
@ -103,32 +103,32 @@
</security:http> </security:http>
<!-- OAuth-protect API and other endpoints --> <!-- OAuth-protect API and other endpoints -->
<security:http pattern="/register/**" use-expressions="true" entry-point-ref="oauthAuthenticationEntryPoint" create-session="stateless"> <security:http pattern="/#{T(org.mitre.openid.connect.web.DynamicClientRegistrationEndpoint).URL}/**" use-expressions="true" entry-point-ref="oauthAuthenticationEntryPoint" create-session="stateless">
<security:custom-filter ref="resourceServerFilter" before="PRE_AUTH_FILTER" /> <security:custom-filter ref="resourceServerFilter" before="PRE_AUTH_FILTER" />
<security:custom-filter ref="corsFilter" after="SECURITY_CONTEXT_FILTER" /> <security:custom-filter ref="corsFilter" after="SECURITY_CONTEXT_FILTER" />
<security:expression-handler ref="oauthWebExpressionHandler" /> <security:expression-handler ref="oauthWebExpressionHandler" />
<security:intercept-url pattern="/register/**" access="permitAll"/> <security:intercept-url pattern="/register/**" access="permitAll"/>
</security:http> </security:http>
<security:http pattern="/resource/**" use-expressions="true" entry-point-ref="oauthAuthenticationEntryPoint" create-session="stateless"> <security:http pattern="/#{T(org.mitre.openid.connect.web.ProtectedResourceRegistrationEndpoint).URL}/**" use-expressions="true" entry-point-ref="oauthAuthenticationEntryPoint" create-session="stateless">
<security:custom-filter ref="resourceServerFilter" before="PRE_AUTH_FILTER" /> <security:custom-filter ref="resourceServerFilter" before="PRE_AUTH_FILTER" />
<security:custom-filter ref="corsFilter" after="SECURITY_CONTEXT_FILTER" /> <security:custom-filter ref="corsFilter" after="SECURITY_CONTEXT_FILTER" />
<security:expression-handler ref="oauthWebExpressionHandler" /> <security:expression-handler ref="oauthWebExpressionHandler" />
<security:intercept-url pattern="/resource/**" access="permitAll"/> <security:intercept-url pattern="/resource/**" access="permitAll"/>
</security:http> </security:http>
<security:http pattern="/userinfo**" use-expressions="true" entry-point-ref="oauthAuthenticationEntryPoint" create-session="stateless"> <security:http pattern="/#{T(org.mitre.openid.connect.web.UserInfoEndpoint).URL}**" use-expressions="true" entry-point-ref="oauthAuthenticationEntryPoint" create-session="stateless">
<security:custom-filter ref="resourceServerFilter" before="PRE_AUTH_FILTER" /> <security:custom-filter ref="resourceServerFilter" before="PRE_AUTH_FILTER" />
<security:custom-filter ref="corsFilter" after="SECURITY_CONTEXT_FILTER" /> <security:custom-filter ref="corsFilter" after="SECURITY_CONTEXT_FILTER" />
<security:expression-handler ref="oauthWebExpressionHandler" /> <security:expression-handler ref="oauthWebExpressionHandler" />
</security:http> </security:http>
<security:http pattern="/api/**" use-expressions="true" entry-point-ref="oauthAuthenticationEntryPoint" create-session="never"> <security:http pattern="/#{T(org.mitre.openid.connect.web.RootController).API_URL}/**" use-expressions="true" entry-point-ref="oauthAuthenticationEntryPoint" create-session="never">
<security:custom-filter ref="resourceServerFilter" before="PRE_AUTH_FILTER" /> <security:custom-filter ref="resourceServerFilter" before="PRE_AUTH_FILTER" />
<security:expression-handler ref="oauthWebExpressionHandler" /> <security:expression-handler ref="oauthWebExpressionHandler" />
</security:http> </security:http>
<security:http pattern="/introspect**" <security:http pattern="/#{T(org.mitre.oauth2.web.IntrospectionEndpoint).URL}**"
use-expressions="true" use-expressions="true"
entry-point-ref="oauthAuthenticationEntryPoint" entry-point-ref="oauthAuthenticationEntryPoint"
create-session="stateless" create-session="stateless"
@ -140,7 +140,7 @@
<security:custom-filter ref="clientCredentialsIntrospectionEndpointFilter" after="BASIC_AUTH_FILTER" /> <security:custom-filter ref="clientCredentialsIntrospectionEndpointFilter" after="BASIC_AUTH_FILTER" />
</security:http> </security:http>
<security:http pattern="/revoke**" <security:http pattern="/#{T(org.mitre.oauth2.web.RevocationEndpoint).URL}**"
use-expressions="true" use-expressions="true"
entry-point-ref="oauthAuthenticationEntryPoint" entry-point-ref="oauthAuthenticationEntryPoint"
create-session="stateless" create-session="stateless"

View File

@ -24,11 +24,16 @@ import org.mitre.discovery.util.WebfingerURLNormalizer;
import org.mitre.jwt.encryption.service.JWTEncryptionAndDecryptionService; import org.mitre.jwt.encryption.service.JWTEncryptionAndDecryptionService;
import org.mitre.jwt.signer.service.JWTSigningAndValidationService; import org.mitre.jwt.signer.service.JWTSigningAndValidationService;
import org.mitre.oauth2.service.SystemScopeService; import org.mitre.oauth2.service.SystemScopeService;
import org.mitre.oauth2.web.IntrospectionEndpoint;
import org.mitre.oauth2.web.RevocationEndpoint;
import org.mitre.openid.connect.config.ConfigurationPropertiesBean; import org.mitre.openid.connect.config.ConfigurationPropertiesBean;
import org.mitre.openid.connect.model.UserInfo; import org.mitre.openid.connect.model.UserInfo;
import org.mitre.openid.connect.service.UserInfoService; import org.mitre.openid.connect.service.UserInfoService;
import org.mitre.openid.connect.view.HttpCodeView; import org.mitre.openid.connect.view.HttpCodeView;
import org.mitre.openid.connect.view.JsonEntityView; import org.mitre.openid.connect.view.JsonEntityView;
import org.mitre.openid.connect.web.DynamicClientRegistrationEndpoint;
import org.mitre.openid.connect.web.JWKSetPublishingEndpoint;
import org.mitre.openid.connect.web.UserInfoEndpoint;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -58,6 +63,10 @@ import com.nimbusds.jose.JWSAlgorithm;
@Controller @Controller
public class DiscoveryEndpoint { public class DiscoveryEndpoint {
public static final String WELL_KNOWN_URL = ".well-known";
public static final String OPENID_CONFIGURATION_URL = WELL_KNOWN_URL + "/openid-configuration";
public static final String WEBFINGER_URL = WELL_KNOWN_URL + "/webfinger";
/** /**
* Logger for this class * Logger for this class
*/ */
@ -91,7 +100,7 @@ public class DiscoveryEndpoint {
} }
}; };
@RequestMapping(value={"/.well-known/webfinger"}, @RequestMapping(value={"/" + WEBFINGER_URL},
params={"resource", "rel=http://openid.net/specs/connect/1.0/issuer"}, produces = MediaType.APPLICATION_JSON_VALUE) params={"resource", "rel=http://openid.net/specs/connect/1.0/issuer"}, produces = MediaType.APPLICATION_JSON_VALUE)
public String webfinger(@RequestParam("resource") String resource, Model model) { public String webfinger(@RequestParam("resource") String resource, Model model) {
@ -135,7 +144,7 @@ public class DiscoveryEndpoint {
return "webfingerView"; return "webfingerView";
} }
@RequestMapping("/.well-known/openid-configuration") @RequestMapping("/" + OPENID_CONFIGURATION_URL)
public String providerConfiguration(Model model) { public String providerConfiguration(Model model) {
/* /*
@ -273,11 +282,11 @@ public class DiscoveryEndpoint {
m.put("issuer", config.getIssuer()); m.put("issuer", config.getIssuer());
m.put("authorization_endpoint", baseUrl + "authorize"); m.put("authorization_endpoint", baseUrl + "authorize");
m.put("token_endpoint", baseUrl + "token"); m.put("token_endpoint", baseUrl + "token");
m.put("userinfo_endpoint", baseUrl + "userinfo"); m.put("userinfo_endpoint", baseUrl + UserInfoEndpoint.URL);
//check_session_iframe //check_session_iframe
//end_session_endpoint //end_session_endpoint
m.put("jwks_uri", baseUrl + "jwk"); m.put("jwks_uri", baseUrl + JWKSetPublishingEndpoint.URL);
m.put("registration_endpoint", baseUrl + "register"); m.put("registration_endpoint", baseUrl + DynamicClientRegistrationEndpoint.URL);
m.put("scopes_supported", scopeService.toStrings(scopeService.getUnrestricted())); // these are the scopes that you can dynamically register for, which is what matters for discovery m.put("scopes_supported", scopeService.toStrings(scopeService.getUnrestricted())); // these are the scopes that you can dynamically register for, which is what matters for discovery
m.put("response_types_supported", Lists.newArrayList("code", "token")); // we don't support these yet: , "id_token", "id_token token")); m.put("response_types_supported", Lists.newArrayList("code", "token")); // we don't support these yet: , "id_token", "id_token token"));
m.put("grant_types_supported", Lists.newArrayList("authorization_code", "implicit", "urn:ietf:params:oauth:grant-type:jwt-bearer", "client_credentials", "urn:ietf:params:oauth:grant_type:redelegate")); m.put("grant_types_supported", Lists.newArrayList("authorization_code", "implicit", "urn:ietf:params:oauth:grant-type:jwt-bearer", "client_credentials", "urn:ietf:params:oauth:grant_type:redelegate"));
@ -328,8 +337,8 @@ public class DiscoveryEndpoint {
m.put("op_policy_uri", baseUrl + "about"); m.put("op_policy_uri", baseUrl + "about");
m.put("op_tos_uri", baseUrl + "about"); m.put("op_tos_uri", baseUrl + "about");
m.put("introspection_endpoint", baseUrl + "introspect"); // token introspection endpoint for verifying tokens m.put("introspection_endpoint", baseUrl + IntrospectionEndpoint.URL); // token introspection endpoint for verifying tokens
m.put("revocation_endpoint", baseUrl + "revoke"); // token revocation endpoint m.put("revocation_endpoint", baseUrl + RevocationEndpoint.URL); // token revocation endpoint
model.addAttribute("entity", m); model.addAttribute("entity", m);

View File

@ -52,6 +52,11 @@ import com.google.common.collect.ImmutableMap;
@Controller @Controller
public class IntrospectionEndpoint { public class IntrospectionEndpoint {
/**
*
*/
public static final String URL = "introspect";
@Autowired @Autowired
private OAuth2TokenEntityService tokenServices; private OAuth2TokenEntityService tokenServices;
@ -84,7 +89,7 @@ public class IntrospectionEndpoint {
} }
@PreAuthorize("hasRole('ROLE_CLIENT')") @PreAuthorize("hasRole('ROLE_CLIENT')")
@RequestMapping("/introspect") @RequestMapping("/" + URL)
public String verify(@RequestParam("token") String tokenValue, public String verify(@RequestParam("token") String tokenValue,
@RequestParam(value = "resource_id", required = false) String resourceId, @RequestParam(value = "resource_id", required = false) String resourceId,
@RequestParam(value = "token_type_hint", required = false) String tokenType, @RequestParam(value = "token_type_hint", required = false) String tokenType,

View File

@ -45,8 +45,10 @@ public class RevocationEndpoint {
*/ */
private static final Logger logger = LoggerFactory.getLogger(RevocationEndpoint.class); private static final Logger logger = LoggerFactory.getLogger(RevocationEndpoint.class);
public static final String URL = "revoke";
@PreAuthorize("hasRole('ROLE_ADMIN') or hasRole('ROLE_CLIENT')") @PreAuthorize("hasRole('ROLE_ADMIN') or hasRole('ROLE_CLIENT')")
@RequestMapping("/revoke") @RequestMapping("/" + URL)
public String revoke(@RequestParam("token") String tokenValue, @RequestParam(value = "token_type_hint", required = false) String tokenType, Principal principal, Model model) { public String revoke(@RequestParam("token") String tokenValue, @RequestParam(value = "token_type_hint", required = false) String tokenType, Principal principal, Model model) {
// This is the token as passed in from OAuth (in case we need it some day) // This is the token as passed in from OAuth (in case we need it some day)

View File

@ -26,6 +26,7 @@ import org.mitre.oauth2.service.SystemScopeService;
import org.mitre.openid.connect.view.HttpCodeView; import org.mitre.openid.connect.view.HttpCodeView;
import org.mitre.openid.connect.view.JsonEntityView; import org.mitre.openid.connect.view.JsonEntityView;
import org.mitre.openid.connect.view.JsonErrorView; import org.mitre.openid.connect.view.JsonErrorView;
import org.mitre.openid.connect.web.RootController;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -50,10 +51,12 @@ import com.google.gson.Gson;
* *
*/ */
@Controller @Controller
@RequestMapping("/api/scopes") @RequestMapping("/" + ScopeAPI.URL)
@PreAuthorize("hasRole('ROLE_USER')") @PreAuthorize("hasRole('ROLE_USER')")
public class ScopeAPI { public class ScopeAPI {
public static final String URL = RootController.API_URL + "/scopes";
@Autowired @Autowired
private SystemScopeService scopeService; private SystemScopeService scopeService;

View File

@ -29,6 +29,7 @@ import org.mitre.oauth2.view.TokenApiView;
import org.mitre.openid.connect.service.OIDCTokenService; import org.mitre.openid.connect.service.OIDCTokenService;
import org.mitre.openid.connect.view.HttpCodeView; import org.mitre.openid.connect.view.HttpCodeView;
import org.mitre.openid.connect.view.JsonErrorView; import org.mitre.openid.connect.view.JsonErrorView;
import org.mitre.openid.connect.web.RootController;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -51,10 +52,12 @@ import org.springframework.web.bind.annotation.RequestMethod;
* *
*/ */
@Controller @Controller
@RequestMapping("/api/tokens") @RequestMapping("/" + TokenAPI.URL)
@PreAuthorize("hasRole('ROLE_USER')") @PreAuthorize("hasRole('ROLE_USER')")
public class TokenAPI { public class TokenAPI {
public static final String URL = RootController.API_URL + "/tokens";
@Autowired @Autowired
private OAuth2TokenEntityService tokenService; private OAuth2TokenEntityService tokenService;

View File

@ -49,10 +49,12 @@ import org.springframework.web.bind.annotation.RequestMethod;
* *
*/ */
@Controller @Controller
@RequestMapping("/api/approved") @RequestMapping("/" + ApprovedSiteAPI.URL)
@PreAuthorize("hasRole('ROLE_USER')") @PreAuthorize("hasRole('ROLE_USER')")
public class ApprovedSiteAPI { public class ApprovedSiteAPI {
public static final String URL = RootController.API_URL + "/approved";
@Autowired @Autowired
private ApprovedSiteService approvedSiteService; private ApprovedSiteService approvedSiteService;

View File

@ -54,10 +54,12 @@ import com.google.gson.JsonSyntaxException;
* *
*/ */
@Controller @Controller
@RequestMapping("/api/blacklist") @RequestMapping("/" + BlacklistAPI.URL)
@PreAuthorize("hasRole('ROLE_ADMIN')") @PreAuthorize("hasRole('ROLE_ADMIN')")
public class BlacklistAPI { public class BlacklistAPI {
public static final String URL = RootController.API_URL + "/blacklist";
@Autowired @Autowired
private BlacklistedSiteService blacklistService; private BlacklistedSiteService blacklistService;

View File

@ -66,10 +66,12 @@ import com.google.gson.JsonSyntaxException;
*/ */
@Controller @Controller
@RequestMapping("/api/clients") @RequestMapping("/" + ClientAPI.URL)
@PreAuthorize("hasRole('ROLE_USER')") @PreAuthorize("hasRole('ROLE_USER')")
public class ClientAPI { public class ClientAPI {
public static final String URL = RootController.API_URL + "/clients";
@Autowired @Autowired
private ClientDetailsEntityService clientService; private ClientDetailsEntityService clientService;

View File

@ -54,10 +54,12 @@ import com.google.gson.stream.JsonWriter;
* *
*/ */
@Controller @Controller
@RequestMapping("/api/data") @RequestMapping("/" + DataAPI.URL)
@PreAuthorize("hasRole('ROLE_ADMIN')") // you need to be an admin to even think about this -- this is a potentially dangerous API!! @PreAuthorize("hasRole('ROLE_ADMIN')") // you need to be an admin to even think about this -- this is a potentially dangerous API!!
public class DataAPI { public class DataAPI {
public static final String URL = RootController.API_URL + "/data";
/** /**
* Logger for this class * Logger for this class
*/ */

View File

@ -66,9 +66,11 @@ import com.google.common.collect.Sets;
import com.google.gson.JsonSyntaxException; import com.google.gson.JsonSyntaxException;
@Controller @Controller
@RequestMapping(value = "register") @RequestMapping(value = DynamicClientRegistrationEndpoint.URL)
public class DynamicClientRegistrationEndpoint { public class DynamicClientRegistrationEndpoint {
public static final String URL = "register";
@Autowired @Autowired
private ClientDetailsEntityService clientService; private ClientDetailsEntityService clientService;

View File

@ -31,10 +31,12 @@ import com.nimbusds.jose.jwk.JWK;
@Controller @Controller
public class JWKSetPublishingEndpoint { public class JWKSetPublishingEndpoint {
public static final String URL = "jwk";
@Autowired @Autowired
private JWTSigningAndValidationService jwtService; private JWTSigningAndValidationService jwtService;
@RequestMapping(value = "/jwk", produces = MediaType.APPLICATION_JSON_VALUE) @RequestMapping(value = "/" + URL, produces = MediaType.APPLICATION_JSON_VALUE)
public String getJwk(Model m) { public String getJwk(Model m) {
// map from key id to key // map from key id to key

View File

@ -63,9 +63,14 @@ import com.google.common.base.Strings;
import com.google.gson.JsonSyntaxException; import com.google.gson.JsonSyntaxException;
@Controller @Controller
@RequestMapping(value = "resource") @RequestMapping(value = ProtectedResourceRegistrationEndpoint.URL)
public class ProtectedResourceRegistrationEndpoint { public class ProtectedResourceRegistrationEndpoint {
/**
*
*/
public static final String URL = "resource";
@Autowired @Autowired
private ClientDetailsEntityService clientService; private ClientDetailsEntityService clientService;

View File

@ -30,29 +30,25 @@ import org.springframework.web.bind.annotation.RequestMapping;
*/ */
@Controller @Controller
public class ManagerController { public class RootController {
public static final String API_URL = "api";
@Autowired @Autowired
private StatsService statsService; private StatsService statsService;
@RequestMapping({"", "home", "index"}) @RequestMapping({"", "home", "index"})
public String showHomePage(ModelMap m) { public String showHomePage(ModelMap m) {
//Map<String, Integer> summary = statsService.getSummaryStats();
//m.put("statsSummary", summary);
return "home"; return "home";
} }
@RequestMapping({"about", "about/"}) @RequestMapping({"about", "about/"})
public String showAboutPage(ModelMap m) { public String showAboutPage(ModelMap m) {
return "about"; return "about";
} }
@RequestMapping({"stats", "stats/"}) @RequestMapping({"stats", "stats/"})
public String showStatsPage(ModelMap m) { public String showStatsPage(ModelMap m) {
Map<String, Integer> summary = statsService.getSummaryStats(); Map<String, Integer> summary = statsService.getSummaryStats();
m.put("statsSummary", summary); m.put("statsSummary", summary);
@ -61,7 +57,6 @@ public class ManagerController {
@RequestMapping({"contact", "contact/"}) @RequestMapping({"contact", "contact/"})
public String showContactPage(ModelMap m) { public String showContactPage(ModelMap m) {
return "contact"; return "contact";
} }

View File

@ -35,8 +35,11 @@ import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
@Controller @Controller
@RequestMapping("/api/stats") @RequestMapping("/" + StatsAPI.URL)
public class StatsAPI { public class StatsAPI {
public static final String URL = RootController.API_URL + "/stats";
// Logger for this class // Logger for this class
private static final Logger logger = LoggerFactory.getLogger(StatsAPI.class); private static final Logger logger = LoggerFactory.getLogger(StatsAPI.class);

View File

@ -20,6 +20,7 @@ import java.util.List;
import org.mitre.oauth2.model.ClientDetailsEntity; import org.mitre.oauth2.model.ClientDetailsEntity;
import org.mitre.oauth2.service.ClientDetailsEntityService; import org.mitre.oauth2.service.ClientDetailsEntityService;
import org.mitre.oauth2.service.SystemScopeService;
import org.mitre.openid.connect.model.UserInfo; import org.mitre.openid.connect.model.UserInfo;
import org.mitre.openid.connect.service.UserInfoService; import org.mitre.openid.connect.service.UserInfoService;
import org.mitre.openid.connect.view.HttpCodeView; import org.mitre.openid.connect.view.HttpCodeView;
@ -52,8 +53,11 @@ import com.google.common.base.Strings;
* *
*/ */
@Controller @Controller
@RequestMapping("/" + UserInfoEndpoint.URL)
public class UserInfoEndpoint { public class UserInfoEndpoint {
public static final String URL = "userinfo";
@Autowired @Autowired
private UserInfoService userInfoService; private UserInfoService userInfoService;
@ -74,8 +78,8 @@ public class UserInfoEndpoint {
/** /**
* Get information about the user as specified in the accessToken included in this request * Get information about the user as specified in the accessToken included in this request
*/ */
@PreAuthorize("hasRole('ROLE_USER') and #oauth2.hasScope('openid')") @PreAuthorize("hasRole('ROLE_USER') and #oauth2.hasScope('" + SystemScopeService.OPENID_SCOPE + "')")
@RequestMapping(value="/userinfo", method= {RequestMethod.GET, RequestMethod.POST}, produces = {MediaType.APPLICATION_JSON_VALUE, JOSE_MEDIA_TYPE_VALUE}) @RequestMapping(method= {RequestMethod.GET, RequestMethod.POST}, produces = {MediaType.APPLICATION_JSON_VALUE, JOSE_MEDIA_TYPE_VALUE})
public String getInfo(@RequestParam(value="claims", required=false) String claimsRequestJsonString, public String getInfo(@RequestParam(value="claims", required=false) String claimsRequestJsonString,
@RequestHeader(value="Accept", required=false) String acceptHeader, @RequestHeader(value="Accept", required=false) String acceptHeader,
OAuth2Authentication auth, Model model) { OAuth2Authentication auth, Model model) {

View File

@ -54,10 +54,12 @@ import com.google.gson.JsonParser;
* *
*/ */
@Controller @Controller
@RequestMapping("/api/whitelist") @RequestMapping("/" + WhitelistAPI.URL)
@PreAuthorize("hasRole('ROLE_USER')") @PreAuthorize("hasRole('ROLE_USER')")
public class WhitelistAPI { public class WhitelistAPI {
public static final String URL = RootController.API_URL + "/whitelist";
@Autowired @Autowired
private WhitelistedSiteService whitelistService; private WhitelistedSiteService whitelistService;