jdk/test/sun/security/krb5/auto/ok-as-delegate.sh
changeset 13075 7fdae33b1abd
parent 13074 aef89cf0f4af
parent 12974 7e981cb0ad6a
child 13076 cb848b70d7f4
equal deleted inserted replaced
13074:aef89cf0f4af 13075:7fdae33b1abd
     1 #
       
     2 # Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
       
     3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       
     4 #
       
     5 # This code is free software; you can redistribute it and/or modify it
       
     6 # under the terms of the GNU General Public License version 2 only, as
       
     7 # published by the Free Software Foundation.
       
     8 #
       
     9 # This code is distributed in the hope that it will be useful, but WITHOUT
       
    10 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
       
    11 # FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
       
    12 # version 2 for more details (a copy is included in the LICENSE file that
       
    13 # accompanied this code).
       
    14 #
       
    15 # You should have received a copy of the GNU General Public License version
       
    16 # 2 along with this work; if not, write to the Free Software Foundation,
       
    17 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
       
    18 #
       
    19 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
       
    20 # or visit www.oracle.com if you need additional information or have any
       
    21 # questions.
       
    22 #
       
    23 
       
    24 # @test
       
    25 # @bug 6853328
       
    26 # @summary Support OK-AS-DELEGATE flag
       
    27 # @run shell/timeout=600 ok-as-delegate.sh
       
    28 #
       
    29 
       
    30 if [ "${TESTSRC}" = "" ] ; then
       
    31   TESTSRC=`dirname $0`
       
    32 fi
       
    33 
       
    34 if [ "${TESTJAVA}" = "" ] ; then
       
    35   JAVAC_CMD=`which javac`
       
    36   TESTJAVA=`dirname $JAVAC_CMD`/..
       
    37 fi
       
    38 
       
    39 # set platform-dependent variables
       
    40 OS=`uname -s`
       
    41 case "$OS" in
       
    42   Windows_* )
       
    43     FS="\\"
       
    44     SEP=";"
       
    45     ;;
       
    46   CYGWIN* )
       
    47     FS="/"
       
    48     SEP=";"
       
    49     ;;
       
    50   * )
       
    51     FS="/"
       
    52     SEP=":"
       
    53     ;;
       
    54 esac
       
    55 
       
    56 ${TESTJAVA}${FS}bin${FS}javac -XDignore.symbol.file -d . \
       
    57     ${TESTSRC}${FS}OkAsDelegate.java \
       
    58     ${TESTSRC}${FS}KDC.java \
       
    59     ${TESTSRC}${FS}OneKDC.java \
       
    60     ${TESTSRC}${FS}Action.java \
       
    61     ${TESTSRC}${FS}Context.java \
       
    62     || exit 10
       
    63 
       
    64 # Testing Kerberos 5
       
    65 
       
    66 # Add $TESTSRC to classpath so that customized nameservice can be used
       
    67 J="${TESTJAVA}${FS}bin${FS}java -cp $TESTSRC${SEP}. OkAsDelegate"
       
    68 JOK="${TESTJAVA}${FS}bin${FS}java -cp $TESTSRC${SEP}. -Dtest.kdc.policy.ok-as-delegate OkAsDelegate"
       
    69 
       
    70 # FORWARDABLE ticket not allowed, always fail
       
    71 $J false true true false false false || exit 1
       
    72 
       
    73 # Service ticket no OK-AS-DELEGATE
       
    74 
       
    75 # Request nothing, gain nothing
       
    76 $J true false false false false false || exit 2
       
    77 # Request deleg policy, gain nothing
       
    78 $J true false true false false false || exit 3
       
    79 # Request deleg, granted
       
    80 $J true true false true false true || exit 4
       
    81 # Request deleg and deleg policy, granted, with info not by policy
       
    82 $J true true true true false true || exit 5
       
    83 
       
    84 # Service ticket has OK-AS-DELEGATE
       
    85 
       
    86 # Request deleg policy, granted
       
    87 $JOK true false true true true true || exit 6
       
    88 # Request deleg and deleg policy, granted, with info by policy
       
    89 $JOK true true true true true true || exit 7
       
    90 
       
    91 # Testing SPNEGO
       
    92 
       
    93 # Add $TESTSRC to classpath so that customized nameservice can be used
       
    94 J="${TESTJAVA}${FS}bin${FS}java -cp $TESTSRC${SEP}. -Dtest.spnego OkAsDelegate"
       
    95 JOK="${TESTJAVA}${FS}bin${FS}java -cp $TESTSRC${SEP}. -Dtest.spnego -Dtest.kdc.policy.ok-as-delegate OkAsDelegate"
       
    96 
       
    97 # FORWARDABLE ticket not allowed, always fail
       
    98 $J false true true false false false || exit 11
       
    99 
       
   100 # Service ticket no OK-AS-DELEGATE
       
   101 
       
   102 # Request nothing, gain nothing
       
   103 $J true false false false false false || exit 12
       
   104 # Request deleg policy, gain nothing
       
   105 $J true false true false false false || exit 13
       
   106 # Request deleg, granted
       
   107 $J true true false true false true || exit 14
       
   108 # Request deleg and deleg policy, granted, with info not by policy
       
   109 $J true true true true false true || exit 15
       
   110 
       
   111 # Service ticket has OK-AS-DELEGATE
       
   112 
       
   113 # Request deleg policy, granted
       
   114 $JOK true false true true true true || exit 16
       
   115 # Request deleg and deleg policy, granted, with info by policy
       
   116 $JOK true true true true true true || exit 17
       
   117 
       
   118 exit 0