@Test public void testUnmappableKerberosNames() { KerberosUserMapper mapper = new KerberosUserMapper(); try { mapper.map("alice@BLAH.NET"); fail(); } catch (IllegalArgumentException e) {} try { mapper.map("@EXAMPLE.COM"); fail(); } catch (IllegalArgumentException e) {} try { mapper.map("@"); fail(); } catch (IllegalArgumentException e) {} }
@Override public String map(String name) { Context context = new Context(); KerberosName principal = new KerberosName(name); context.put("principal", principal.getFullName()); context.put("primary", principal.getPrimary()); context.put("instance", principal.getInstance()); context.put("realm", principal.getRealm()); for (Rule rule : rulesList) { boolean isApplicable = rule.evaluateIfCondition(context); if (isApplicable) { return rule.evaluateThenExpression(context); } } throw new IllegalArgumentException("Principal `" + name + "` cannot be mapped to a Google identity."); }
KerberosUserMapper extends AbstractUserMapper { @Override public String map(String name) { Context context = new Context(); KerberosName principal = new KerberosName(name); context.put("principal", principal.getFullName()); context.put("primary", principal.getPrimary()); context.put("instance", principal.getInstance()); context.put("realm", principal.getRealm()); for (Rule rule : rulesList) { boolean isApplicable = rule.evaluateIfCondition(context); if (isApplicable) { return rule.evaluateThenExpression(context); } } throw new IllegalArgumentException("Principal `" + name + "` cannot be mapped to a Google identity."); } }
KerberosUserMapper extends AbstractUserMapper { @Override public String map(String name) { Context context = new Context(); KerberosName principal = new KerberosName(name); context.put("principal", principal.getFullName()); context.put("primary", principal.getPrimary()); context.put("instance", principal.getInstance()); context.put("realm", principal.getRealm()); for (Rule rule : rulesList) { boolean isApplicable = rule.evaluateIfCondition(context); if (isApplicable) { return rule.evaluateThenExpression(context); } } throw new IllegalArgumentException("Principal `" + name + "` cannot be mapped to a Google identity."); } KerberosUserMapper(); }
KerberosUserMapper extends AbstractUserMapper { @Override public String map(String name) { Context context = new Context(); KerberosName principal = new KerberosName(name); context.put("principal", principal.getFullName()); context.put("primary", principal.getPrimary()); context.put("instance", principal.getInstance()); context.put("realm", principal.getRealm()); for (Rule rule : rulesList) { boolean isApplicable = rule.evaluateIfCondition(context); if (isApplicable) { return rule.evaluateThenExpression(context); } } throw new IllegalArgumentException("Principal `" + name + "` cannot be mapped to a Google identity."); } KerberosUserMapper(); @Override String map(String name); }
KerberosUserMapper extends AbstractUserMapper { @Override public String map(String name) { Context context = new Context(); KerberosName principal = new KerberosName(name); context.put("principal", principal.getFullName()); context.put("primary", principal.getPrimary()); context.put("instance", principal.getInstance()); context.put("realm", principal.getRealm()); for (Rule rule : rulesList) { boolean isApplicable = rule.evaluateIfCondition(context); if (isApplicable) { return rule.evaluateThenExpression(context); } } throw new IllegalArgumentException("Principal `" + name + "` cannot be mapped to a Google identity."); } KerberosUserMapper(); @Override String map(String name);  }