jdk/test/com/sun/security/auth/module/LdapLoginModule/CheckOptions.java
changeset 7970 af1579474d16
parent 5506 202f599c92aa
child 9035 1255eb81cc2f
equal deleted inserted replaced
7969:1a6282ab0d2a 7970:af1579474d16
    71             System.out.println("Caught a LoginException, as expected");
    71             System.out.println("Caught a LoginException, as expected");
    72         }
    72         }
    73 
    73 
    74         // bad value for userProvider option
    74         // bad value for userProvider option
    75 
    75 
    76         Map<String, String> options = new HashMap<String, String>();
    76         Map<String, String> options = new HashMap<>();
    77         options.put(USER_PROVIDER_OPTION, "ldap://localhost:23456");
    77         options.put(USER_PROVIDER_OPTION, "ldap://localhost:23456");
    78         ldap.initialize(subject, null, null, options);
    78         ldap.initialize(subject, null, null, options);
    79 
    79 
    80         try {
    80         try {
    81             ldap.login();
    81             ldap.login();
    91 
    91 
    92         // empty set of options
    92         // empty set of options
    93 
    93 
    94         LdapLoginModule ldap = new LdapLoginModule();
    94         LdapLoginModule ldap = new LdapLoginModule();
    95         Subject subject = new Subject();
    95         Subject subject = new Subject();
    96         Map<String, String> options = new HashMap<String, String>();
    96         Map<String, String> options = new HashMap<>();
    97         ldap.initialize(subject, null, null, options);
    97         ldap.initialize(subject, null, null, options);
    98 
    98 
    99         try {
    99         try {
   100             ldap.login();
   100             ldap.login();
   101             throw new SecurityException("expected LoginException");
   101             throw new SecurityException("expected LoginException");
   108 
   108 
   109     private static void testWithCallbackHandler() throws Exception {
   109     private static void testWithCallbackHandler() throws Exception {
   110 
   110 
   111         LdapLoginModule ldap = new LdapLoginModule();
   111         LdapLoginModule ldap = new LdapLoginModule();
   112         Subject subject = new Subject();
   112         Subject subject = new Subject();
   113         Map<String, String> options = new HashMap<String, String>();
   113         Map<String, String> options = new HashMap<>();
   114 
   114 
   115         CallbackHandler goodHandler = new MyCallbackHandler(true);
   115         CallbackHandler goodHandler = new MyCallbackHandler(true);
   116         ldap.initialize(subject, goodHandler, null, options);
   116         ldap.initialize(subject, goodHandler, null, options);
   117 
   117 
   118         try {
   118         try {