X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fnorthbound%2Fstaticrouting%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fforwarding%2Fstaticrouting%2Fnorthbound%2FStaticRoutingNorthbound.java;h=b85f5641c73ea9af99fd3b201909220367c8240b;hb=ff1b4a79cca00743a00c3b0b1100bd0ab2b2fb31;hp=c48d7ec02684463962909ec2d60b600e3b270167;hpb=af9729aac43f1dd32b77076d757e3052d7a8e87b;p=controller.git diff --git a/opendaylight/northbound/staticrouting/src/main/java/org/opendaylight/controller/forwarding/staticrouting/northbound/StaticRoutingNorthbound.java b/opendaylight/northbound/staticrouting/src/main/java/org/opendaylight/controller/forwarding/staticrouting/northbound/StaticRoutingNorthbound.java index c48d7ec026..b85f5641c7 100644 --- a/opendaylight/northbound/staticrouting/src/main/java/org/opendaylight/controller/forwarding/staticrouting/northbound/StaticRoutingNorthbound.java +++ b/opendaylight/northbound/staticrouting/src/main/java/org/opendaylight/controller/forwarding/staticrouting/northbound/StaticRoutingNorthbound.java @@ -51,7 +51,7 @@ import org.opendaylight.controller.sal.utils.Status; * Authentication realm : opendaylight
* Transport : HTTP and HTTPS
*
- * HTTPS Authentication is disabled by default. Administrator can enable it in tomcat-server.xml after adding + * HTTPS Authentication is disabled by default. Administrator can enable it in tomcat-server.xml after adding * a proper keystore / SSL certificate from a trusted authority.
* More info : http://tomcat.apache.org/tomcat-7.0-doc/ssl-howto.html#Configuration */ @@ -59,18 +59,18 @@ import org.opendaylight.controller.sal.utils.Status; public class StaticRoutingNorthbound { - private String username; - + private String username; + @Context public void setSecurityContext(SecurityContext context) { - username = context.getUserPrincipal().getName(); + username = context.getUserPrincipal().getName(); } protected String getUserName() { return username; } - - + + private List getStaticRoutesInternal(String containerName) { IForwardingStaticRouting staticRouting = (IForwardingStaticRouting) ServiceHelper @@ -109,9 +109,9 @@ public class StaticRoutingNorthbound { public StaticRoutes getStaticRoutes( @PathParam("containerName") String containerName) { - if(!NorthboundUtils.isAuthorized(getUserName(), containerName, + if(!NorthboundUtils.isAuthorized(getUserName(), containerName, Privilege.WRITE, this)){ - throw new + throw new UnauthorizedException("User is not authorized to perform this operation on container " + containerName); } @@ -136,9 +136,9 @@ public class StaticRoutingNorthbound { @PathParam("containerName") String containerName, @PathParam("name") String name) { - if(!NorthboundUtils.isAuthorized(getUserName(), containerName, + if(!NorthboundUtils.isAuthorized(getUserName(), containerName, Privilege.WRITE, this)){ - throw new + throw new UnauthorizedException("User is not authorized to perform this operation on container " + containerName); } @@ -174,10 +174,10 @@ public class StaticRoutingNorthbound { @PathParam(value = "name") String name, @TypeHint(StaticRoute.class) JAXBElement staticRouteData) { - - if(!NorthboundUtils.isAuthorized(getUserName(), containerName, + + if(!NorthboundUtils.isAuthorized(getUserName(), containerName, Privilege.WRITE, this)){ - throw new + throw new UnauthorizedException("User is not authorized to perform this operation on container " + containerName); } @@ -221,10 +221,10 @@ public class StaticRoutingNorthbound { public Response removeStaticRoute( @PathParam(value = "containerName") String containerName, @PathParam(value = "name") String name) { - - if(!NorthboundUtils.isAuthorized(getUserName(), containerName, + + if(!NorthboundUtils.isAuthorized(getUserName(), containerName, Privilege.WRITE, this)){ - throw new + throw new UnauthorizedException("User is not authorized to perform this operation on container " + containerName); }