Search in sources :

Example 1 with LoginConfigImpl

use of sun.security.jgss.LoginConfigImpl in project jdk8u_jdk by JetBrains.

the class DefaultGssConfig method main.

public static void main(String[] argv) throws Exception {
    // 1. Make sure the FileNotFoundException is hidden
    try {
        Configuration.getInstance("JavaLoginConfig", new URIParameter(new URI("file:///no/such/file")));
    } catch (NoSuchAlgorithmException nsae) {
        if (nsae.getCause() instanceof IOException && !(nsae.getCause() instanceof FileNotFoundException)) {
        // ignore
        } else {
            throw nsae;
        }
    }
    // 2. Make sure there's always a Configuration even if no config file exists
    Configuration.getConfiguration();
    // 3. Make sure there're default entries for GSS krb5 client/server
    LoginConfigImpl lc = new LoginConfigImpl(GSSCaller.CALLER_INITIATE, GSSUtil.GSS_KRB5_MECH_OID);
    if (lc.getAppConfigurationEntry("").length == 0) {
        throw new Exception("No default config for GSS krb5 client");
    }
    lc = new LoginConfigImpl(GSSCaller.CALLER_ACCEPT, GSSUtil.GSS_KRB5_MECH_OID);
    if (lc.getAppConfigurationEntry("").length == 0) {
        throw new Exception("No default config for GSS krb5 server");
    }
}
Also used : URIParameter(java.security.URIParameter) FileNotFoundException(java.io.FileNotFoundException) LoginConfigImpl(sun.security.jgss.LoginConfigImpl) NoSuchAlgorithmException(java.security.NoSuchAlgorithmException) IOException(java.io.IOException) URI(java.net.URI) NoSuchAlgorithmException(java.security.NoSuchAlgorithmException) IOException(java.io.IOException) FileNotFoundException(java.io.FileNotFoundException)

Aggregations

FileNotFoundException (java.io.FileNotFoundException)1 IOException (java.io.IOException)1 URI (java.net.URI)1 NoSuchAlgorithmException (java.security.NoSuchAlgorithmException)1 URIParameter (java.security.URIParameter)1 LoginConfigImpl (sun.security.jgss.LoginConfigImpl)1