Examples of PrivilegedExceptionAction


Examples of com.sun.star.comp.security.PrivilegedExceptionAction

    throws com.sun.star.uno.Exception, com.sun.star.uno.RuntimeException
  {
    try
    {
      /*return*/ javax.security.auth.Subject.doAs(
        _subject, new PrivilegedExceptionAction( action ) );
    }
    catch (java.security.PrivilegedActionException exc)
    {
      AccessController.rethrowException( exc );
//        return null; // for dummy
View Full Code Here

Examples of java.security.PrivilegedExceptionAction

    final boolean[] exceptionCatched = new boolean[1];
    final Store store = new MemoryStoreImpl();
    Subject subject = new Subject();
    System.setSecurityManager(new SecurityManager());
    try {
      Subject.doAsPrivileged(subject, new PrivilegedExceptionAction() {
        public Object run() throws Exception {
          Source source = new SourceImpl("http://example.org/graph-source");
          Subject subject2 = new Subject();
          try {
            Subject.doAsPrivileged(null, new PrivilegedExceptionAction() {
              public Object run() throws Exception {
                Source source = new SourceImpl("http://example.org/graph-source");
                try {
                  store.assertGraph(source, new FCAGraphImpl(new SimpleGraph()));
                } catch (AccessControlException ex) {
View Full Code Here

Examples of java.security.PrivilegedExceptionAction

      throws HandlerException {
    if (request.getRequestURI().getPath().equals("/meta/account-manager")) {
      Subject subject = new Subject();
      subject.getPrincipals().add(SuperUserGVSPrincipal.instance);
      try {
        Subject.doAsPrivileged(subject, new PrivilegedExceptionAction() {
          public Object run() throws Exception {
            wrapped.handle(request, response);
            return null;
          }
        }, null);
      } catch (PrivilegedActionException e) {
        throw new RuntimeException(e);
      }
    } else {
      LoginContext loginContext;
      try {
        loginContext = new LoginContext("GVS-Auth", new CookieCallbackHandler(request));
        loginContext.login();
      } catch (LoginException e) {
        /*response.setResponseStatus(ResponseStatus.FORBIDDEN);
        log.info(e);
        response.setBody(new MessageBody2Read() {
 
          public ReadableByteChannel read() throws IOException {
            return Channels.newChannel(new ByteArrayInputStream("Login Failed".getBytes()));
          }
         
        });
        return;*/
        try {
          Cookie loginCookie = new Cookie("login", "-");
          loginCookie.setMaxAge(-1);
          response.setHeader(HeaderName.SET_COOKIE, loginCookie.toString());

          loginContext = new LoginContext("GVS-Auth", new CallbackHandler() {

            public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException {
              for (int i = 0; i < callbacks.length; i++) {
                if (callbacks[i] instanceof NameCallback) {
                  ((NameCallback) callbacks[i]).setName("");
                } else if (callbacks[i] instanceof PasswordCallback) {
                  ((PasswordCallback) callbacks[i]).setPassword(""
                      .toCharArray());
                } else {
                  throw new UnsupportedCallbackException(callbacks[i],
                      "Callback class not supported");
                }

              }
             
            }
         
          });
          loginContext.login();
        } catch (LoginException e1) {
          // TODO Auto-generated catch block
          throw new RuntimeException(e1);
        }
       
      }
      try {
        Subject subject = loginContext.getSubject();
        Subject.doAsPrivileged(subject, new PrivilegedExceptionAction() {
          public Object run() throws Exception {
            wrapped.handle(request, response);
            return null;
          }
        }, null);
View Full Code Here

Examples of java.security.PrivilegedExceptionAction

    public URL getURL() throws FileSystemException
    {
        final StringBuffer buf = new StringBuffer();
        try
        {
            return (URL) AccessController.doPrivileged(new PrivilegedExceptionAction()
            {
                public Object run() throws MalformedURLException
                {
                    return new URL(UriParser.extractScheme(name.getURI(), buf), "", -1,
                        buf.toString(), new DefaultURLStreamHandler(fs.getContext(), fs.getFileSystemOptions()));
View Full Code Here

Examples of java.security.PrivilegedExceptionAction

    FileInputStream getFileInputStream(final File file)
        throws FileNotFoundException
    {
        try {
            return (FileInputStream)
                AccessController.doPrivileged(new PrivilegedExceptionAction() {
                    public Object run() throws FileNotFoundException {
                        return new FileInputStream(file);
                    }
                });
        } catch (PrivilegedActionException e) {
View Full Code Here

Examples of java.security.PrivilegedExceptionAction

    FileInputStream getFileInputStream(final File file)
        throws FileNotFoundException
    {
        try {
            return (FileInputStream)
                AccessController.doPrivileged(new PrivilegedExceptionAction() {
                    public Object run() throws FileNotFoundException {
                        return new FileInputStream(file);
                    }
                });
        } catch (PrivilegedActionException e) {
View Full Code Here

Examples of java.security.PrivilegedExceptionAction

    FileInputStream getFileInputStream(final File file)
    throws FileNotFoundException
    {
        try {
            return (FileInputStream)
            AccessController.doPrivileged(new PrivilegedExceptionAction() {
                public Object run() throws FileNotFoundException {
                    return new FileInputStream(file);
                }
            });
        } catch (PrivilegedActionException e) {
View Full Code Here

Examples of java.security.PrivilegedExceptionAction

    FileInputStream getFileInputStream(final File file)
        throws FileNotFoundException
    {
        try {
            return (FileInputStream)
                AccessController.doPrivileged(new PrivilegedExceptionAction() {
                    public Object run() throws FileNotFoundException {
                        return new FileInputStream(file);
                    }
                });
        } catch (PrivilegedActionException e) {
View Full Code Here

Examples of java.security.PrivilegedExceptionAction

    FileInputStream getFileInputStream(final File file)
        throws FileNotFoundException
    {
        try {
            return (FileInputStream)
                AccessController.doPrivileged(new PrivilegedExceptionAction() {
                    public Object run() throws FileNotFoundException {
                        return new FileInputStream(file);
                    }
                });
        } catch (PrivilegedActionException e) {
View Full Code Here

Examples of java.security.PrivilegedExceptionAction

    FileInputStream getFileInputStream(final File file)
        throws FileNotFoundException
    {
        try {
            return (FileInputStream)
                AccessController.doPrivileged(new PrivilegedExceptionAction() {
                    public Object run() throws FileNotFoundException {
                        return new FileInputStream(file);
                    }
                });
        } catch (PrivilegedActionException e) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.