TrustedCert.java revision 2362
4340N/A/*
4340N/A * Copyright (c) 2001, Oracle and/or its affiliates. All rights reserved.
4340N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4340N/A *
4340N/A * This code is free software; you can redistribute it and/or modify it
4340N/A * under the terms of the GNU General Public License version 2 only, as
4340N/A * published by the Free Software Foundation.
4340N/A *
4340N/A * This code is distributed in the hope that it will be useful, but WITHOUT
4340N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
4340N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
4340N/A * version 2 for more details (a copy is included in the LICENSE file that
4340N/A * accompanied this code).
4340N/A *
4340N/A * You should have received a copy of the GNU General Public License version
4340N/A * 2 along with this work; if not, write to the Free Software Foundation,
4340N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
4340N/A *
4340N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
4340N/A * or visit www.oracle.com if you need additional information or have any
4340N/A * questions.
4340N/A */
4340N/A
4340N/A/*
4340N/A * @test
4340N/A * @bug 4409615
4340N/A * @summary KeyStore alias principal grant fails for trusted certificate entry
4340N/A *
4340N/A * this should always work:
4340N/A * main/othervm/policy=TrustedCert.policy \
4340N/A * -Dkeystore=TrustedCert.keystore1 -Dfoo=bar TrustedCert
4340N/A *
4340N/A * @run main/othervm/policy=TrustedCert.policy -Dkeystore=TrustedCert.keystore1 -Dfoo=bar TrustedCert
4340N/A */
4503N/A
4503N/Aimport java.security.PrivilegedAction;
4503N/Aimport java.util.Collections;
4340N/Aimport javax.security.auth.Subject;
4503N/Aimport javax.security.auth.x500.X500Principal;
4503N/A
4503N/Apublic class TrustedCert {
4340N/A
4340N/A public static void main(String[] args) {
4340N/A System.out.println(
4340N/A Subject.doAsPrivileged(
4340N/A new Subject(true,
4503N/A Collections.singleton(new X500Principal("CN=Tim")),
4340N/A Collections.EMPTY_SET,
4340N/A Collections.EMPTY_SET),
4340N/A new PrivilegedAction() {
4340N/A public Object run() {
4340N/A return System.getProperty("foo");
4340N/A }
4340N/A },
4340N/A null));
4340N/A }
4340N/A}
4340N/A