1941N/A#
2362N/A# Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
1941N/A# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
1941N/A#
1941N/A# This code is free software; you can redistribute it and/or modify it
1941N/A# under the terms of the GNU General Public License version 2 only, as
1941N/A# published by the Free Software Foundation.
1941N/A#
1941N/A# This code is distributed in the hope that it will be useful, but WITHOUT
1941N/A# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
1941N/A# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
1941N/A# version 2 for more details (a copy is included in the LICENSE file that
1941N/A# accompanied this code).
1941N/A#
1941N/A# You should have received a copy of the GNU General Public License version
1941N/A# 2 along with this work; if not, write to the Free Software Foundation,
1941N/A# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
1941N/A#
2362N/A# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2362N/A# or visit www.oracle.com if you need additional information or have any
2362N/A# questions.
1941N/A#
1941N/A
1941N/A# @test
1941N/A# @bug 6853328
1941N/A# @summary Support OK-AS-DELEGATE flag
1941N/A# @run shell/timeout=600 ok-as-delegate.sh
1941N/A#
1941N/A
1941N/Aif [ "${TESTSRC}" = "" ] ; then
1941N/A TESTSRC=`dirname $0`
1941N/Afi
1941N/A
1941N/Aif [ "${TESTJAVA}" = "" ] ; then
1941N/A JAVAC_CMD=`which javac`
1941N/A TESTJAVA=`dirname $JAVAC_CMD`/..
1941N/Afi
1941N/A
1941N/A# set platform-dependent variables
1941N/AOS=`uname -s`
1941N/Acase "$OS" in
1941N/A Windows_* )
1941N/A FS="\\"
1941N/A SEP=";"
1941N/A ;;
1941N/A CYGWIN* )
1941N/A FS="/"
1941N/A SEP=";"
1941N/A ;;
1941N/A * )
1941N/A FS="/"
1941N/A SEP=":"
1941N/A ;;
1941N/Aesac
1941N/A
1941N/A${TESTJAVA}${FS}bin${FS}javac -XDignore.symbol.file -d . \
1941N/A ${TESTSRC}${FS}OkAsDelegate.java \
1941N/A ${TESTSRC}${FS}KDC.java \
1941N/A ${TESTSRC}${FS}OneKDC.java \
1941N/A ${TESTSRC}${FS}Action.java \
1941N/A ${TESTSRC}${FS}Context.java \
1941N/A || exit 10
1941N/A
1941N/A# Testing Kerberos 5
1941N/A
1941N/A# Add $TESTSRC to classpath so that customized nameservice can be used
1941N/AJ="${TESTJAVA}${FS}bin${FS}java -cp $TESTSRC${SEP}. OkAsDelegate"
1941N/AJOK="${TESTJAVA}${FS}bin${FS}java -cp $TESTSRC${SEP}. -Dtest.kdc.policy.ok-as-delegate OkAsDelegate"
1941N/A
1941N/A# FORWARDABLE ticket not allowed, always fail
1941N/A$J false true true false false false || exit 1
1941N/A
1941N/A# Service ticket no OK-AS-DELEGATE
1941N/A
1941N/A# Request nothing, gain nothing
1941N/A$J true false false false false false || exit 2
1941N/A# Request deleg policy, gain nothing
1941N/A$J true false true false false false || exit 3
1941N/A# Request deleg, granted
1941N/A$J true true false true false true || exit 4
1941N/A# Request deleg and deleg policy, granted, with info not by policy
1941N/A$J true true true true false true || exit 5
1941N/A
1941N/A# Service ticket has OK-AS-DELEGATE
1941N/A
1941N/A# Request deleg policy, granted
1941N/A$JOK true false true true true true || exit 6
1941N/A# Request deleg and deleg policy, granted, with info by policy
1941N/A$JOK true true true true true true || exit 7
1941N/A
1941N/A# Testing SPNEGO
1941N/A
1941N/A# Add $TESTSRC to classpath so that customized nameservice can be used
1941N/AJ="${TESTJAVA}${FS}bin${FS}java -cp $TESTSRC${SEP}. -Dtest.spnego OkAsDelegate"
1941N/AJOK="${TESTJAVA}${FS}bin${FS}java -cp $TESTSRC${SEP}. -Dtest.spnego -Dtest.kdc.policy.ok-as-delegate OkAsDelegate"
1941N/A
1941N/A# FORWARDABLE ticket not allowed, always fail
1941N/A$J false true true false false false || exit 11
1941N/A
1941N/A# Service ticket no OK-AS-DELEGATE
1941N/A
1941N/A# Request nothing, gain nothing
1941N/A$J true false false false false false || exit 12
1941N/A# Request deleg policy, gain nothing
1941N/A$J true false true false false false || exit 13
1941N/A# Request deleg, granted
1941N/A$J true true false true false true || exit 14
1941N/A# Request deleg and deleg policy, granted, with info not by policy
1941N/A$J true true true true false true || exit 15
1941N/A
1941N/A# Service ticket has OK-AS-DELEGATE
1941N/A
1941N/A# Request deleg policy, granted
1941N/A$JOK true false true true true true || exit 16
1941N/A# Request deleg and deleg policy, granted, with info by policy
1941N/A$JOK true true true true true true || exit 17
1941N/A
1941N/Aexit 0