Examples of DistinguishedName


Examples of org.springframework.ldap.core.DistinguishedName

    public void userDnWithEscapedCharacterParameterReturnsExpectedRoles() {
        populator.setGroupRoleAttribute("ou");
        populator.setConvertToUpperCase(true);
        populator.setGroupSearchFilter("(member={0})");

        DirContextAdapter ctx = new DirContextAdapter(new DistinguishedName("cn=mouse\\, jerry,ou=people,dc=springframework,dc=org"));

        Set<String> authorities = AuthorityUtils.authorityListToSet(populator.getGrantedAuthorities(ctx, "notused"));

        assertEquals("Should have 1 role", 1, authorities.size());
        assertTrue(authorities.contains("ROLE_MANAGER"));
View Full Code Here

Examples of org.springframework.ldap.core.DistinguishedName

    public void testWithUserSearch() {
        authenticator = new PasswordComparisonAuthenticator(getContextSource());
        authenticator.setPasswordEncoder(new PlaintextPasswordEncoder());
        assertTrue("User DN matches shouldn't be available", authenticator.getUserDns("Bob").isEmpty());

        DirContextAdapter ctx = new DirContextAdapter(new DistinguishedName("uid=Bob,ou=people"));
        ctx.setAttributeValue("userPassword", "bobspassword");

        authenticator.setUserSearch(new MockUserSearch(ctx));
        authenticator.authenticate(new UsernamePasswordAuthenticationToken("shouldntbeused", "bobspassword"));
    }
View Full Code Here

Examples of org.springframework.ldap.core.DistinguishedName

        return ctx;
    }

    protected DirContextAdapter createCtx(final String parentDn, final RegisteredService service) {
        DistinguishedName dn = new DistinguishedName(parentDn);
        dn.add(this.namingAttribute, service.getName());
        return new DirContextAdapter(dn);
    }
View Full Code Here

Examples of org.springframework.ldap.support.DistinguishedName

  protected String passwordAttrName = "userPassword";

  protected boolean doVerify(Authentication auth) {
    String userName = (String) auth.getPrincipal();
    String password = (String) auth.getCredentials();
    DistinguishedName dn = new DistinguishedName(nameAttrName + "=" + userName);
    String ldapPassword = null;
    try {
      ldapPassword = (String) ldapTemplate.lookup(dn, new String[] { "userPassword" },
          new ContextMapper() {
            public Object mapFromContext(Object ctx) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.