add Costant
This commit is contained in:
parent
a49ef41abd
commit
8aa338a5b6
|
@ -27,6 +27,8 @@ import org.gcube.common.encryption.StringEncrypter;
|
||||||
@Path("ServiceEndpoint")
|
@Path("ServiceEndpoint")
|
||||||
public class ServiceEndpointResource {
|
public class ServiceEndpointResource {
|
||||||
|
|
||||||
|
public static final String ENABLED_ROLE="service-endpoint-key";
|
||||||
|
|
||||||
@GET
|
@GET
|
||||||
@Path("/{category}")
|
@Path("/{category}")
|
||||||
@Produces(MediaType.APPLICATION_XML)
|
@Produces(MediaType.APPLICATION_XML)
|
||||||
|
@ -182,7 +184,7 @@ public class ServiceEndpointResource {
|
||||||
log.debug("checking role");
|
log.debug("checking role");
|
||||||
String at= AccessTokenProvider.instance.get();
|
String at= AccessTokenProvider.instance.get();
|
||||||
try{
|
try{
|
||||||
if (ModelUtils.getAccessTokenFrom(at).getRealmAccess().getRoles().contains("service-endpoint-key" )) {
|
if (ModelUtils.getAccessTokenFrom(at).getRealmAccess().getRoles().contains(ENABLED_ROLE )) {
|
||||||
log.info("The client is authorized to see the resource as 'free-to-air'");
|
log.info("The client is authorized to see the resource as 'free-to-air'");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue