/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* This class starts a simple KDC with one realm, several typical principal
* names, generates delete-on-exit krb5.conf and keytab files, and setup
* system properties for them. There's also a helper method to generate a
* JAAS login config file that can be used for JAAS or JGSS apps.
* <p>
* Just call this line to start everything:
* <pre>
* new OneKDC(null).writeJaasConf();
* </pre>
*/
/**
* Creates the KDC and starts it.
* @param etype Encryption type, null if not specified
* @throws java.lang.Exception if there's anything wrong
*/
"forwardable = true",
"default_keytab_name = " + KTAB,
// Whatever krb5.conf had been loaded before, we reload ours now.
}
/**
* Writes a JAAS login config file, which contains as many as useful
* entries with names using existing OneKDC principals.
* @throws java.lang.Exception if anything goes wrong
*/
"com.sun.security.jgss.krb5.initiate {\n" +
" com.sun.security.auth.module.Krb5LoginModule required;\n};\n" +
"com.sun.security.jgss.krb5.accept {\n" +
" com.sun.security.auth.module.Krb5LoginModule required\n" +
" useKeyTab=true\n" +
" isInitiator=false\n" +
" storeKey=true;\n};\n" +
"client {\n" +
" com.sun.security.auth.module.Krb5LoginModule required;\n};\n" +
"server {\n" +
" com.sun.security.auth.module.Krb5LoginModule required\n" +
" useKeyTab=true\n" +
" storeKey=true;\n};\n" +
"backend {\n" +
" com.sun.security.auth.module.Krb5LoginModule required\n" +
" useKeyTab=true\n" +
" storeKey=true\n" +
" isInitiator=false;\n};\n"
).getBytes());
f.deleteOnExit();
}
/**
* The default callback handler for JAAS login. Note that this handler is
* hard coded to provide only info for USER1. If you need to provide info
* for another principal, please use Context.fromUserPass() instead.
*/
if (callback instanceof NameCallback) {
}
if (callback instanceof PasswordCallback) {
}
}
}
}
}