java - Granting URL Permission in policy file in JAAS -
i have made rest application working fine on own.
import javax.ws.rs.get; import javax.ws.rs.path; @path("/helloworld") public class helloworldresource { @get public string getmessage() { return "hello world!"; } }
i want invoke client using jaas.there 2 principals namely userprincipal , systemadminprincipal.i want invoke web service when principal systemadminprincipal.i using urlpermission grant permission , apache httpclient execute method. policy file is
grant principal userprincipal "user" { }; grant principal sysadminprincipal "sysadmin" { permission java.net.urlpermission "http://localhost:8080/helloworldrest/helloworld","get"; };
but encountering security exception systemadminprincipal.probably usage of urlpermission faulty case.could point how use urlpermission.thanks in advance.
the policy file should grant socket permission prior granting urlpermission .the policy file should be.
grant principal sysadminprincipal "sysadmin" { permission java.net.socketpermission "127.0.0.1:8080","connect,resolve"; permission java.net.urlpermission "http://localhost:8080/helloworldrest/helloworld","get"; }; grant principal userprincipal "user" { };
Comments
Post a Comment