Package org.springframework.ldap.core

Examples of org.springframework.ldap.core.AuthenticatedLdapEntryContextCallback


    @Override
    public SortedSet<String> getUserNamesForRole(final GeoServerRole role)
            throws IOException {
        final SortedSet<String> users = new TreeSet<String>();
       
        authenticateIfNeeded(new AuthenticatedLdapEntryContextCallback() {
           
            @Override
            public void executeWithContext(DirContext ctx,
                    LdapEntryIdentification ldapEntryIdentification) {
                fillUsersForRole(ctx, users, role);
View Full Code Here


            throws IOException {
        final SortedSet<GeoServerRole> roles = new TreeSet<GeoServerRole>();
        final Set<String> userDn = new HashSet<String>();
        userDn.add(username);
        if (lookupUserForDn && isNotEmpty(userFilter)) {
            authenticateIfNeeded(new AuthenticatedLdapEntryContextCallback() {
   
                @Override
                public void executeWithContext(DirContext ctx,
                        LdapEntryIdentification ldapEntryIdentification) {
                    try {
                        String dn = LDAPUtils
                                .getLdapTemplateInContext(ctx, template)
                                .searchForSingleEntry("", userFilter,
                                        new String[] { username }).getDn()
                                .toString();
                        userDn.clear();
                        userDn.add(dn);
                    } catch (Exception e) {
                        // not found, let's use username instead
                    }
                }
            });
        }
        authenticateIfNeeded(new AuthenticatedLdapEntryContextCallback() {
   
            @Override
            public void executeWithContext(DirContext ctx,
                    LdapEntryIdentification ldapEntryIdentification) {
                fillRolesForUser(ctx, username, userDn.iterator().next(), roles);
View Full Code Here

    @Override
    public SortedSet<GeoServerRole> getRoles() throws IOException {
        final SortedSet<GeoServerRole> roles = new TreeSet<GeoServerRole>();
       
        authenticateIfNeeded(new AuthenticatedLdapEntryContextCallback() {
           
            @Override
            public void executeWithContext(DirContext ctx,
                    LdapEntryIdentification ldapEntryIdentification) {
                fillAllRoles(ctx, roles);
View Full Code Here

    }

    private String getUserNameFromMembership(final String user) {
        final Set<String> userName = new HashSet<String>();
        userName.add(user);
        authenticateIfNeeded(new AuthenticatedLdapEntryContextCallback() {
           
            @Override
            public void executeWithContext(DirContext ctx,
                    LdapEntryIdentification ldapEntryIdentification) {
                DirContextOperations obj = (DirContextOperations)LDAPUtils
View Full Code Here

            // remove standard role prefix
            role = role.substring(5);
        }
        final String roleName = role;
        final SortedSet<String> roles = new TreeSet<String>();
        authenticateIfNeeded(new AuthenticatedLdapEntryContextCallback() {
   
            @Override
            public void executeWithContext(DirContext ctx,
                    LdapEntryIdentification ldapEntryIdentification) {
                roles.addAll(LDAPUtils.getLdapTemplateInContext(ctx, template)
View Full Code Here

            final String userName = userAndPassword[0];
            String password = userAndPassword[1];
            // authenticate and execute role extraction in the authenticated
            // context
            ldapTemplate.authenticate(DistinguishedName.EMPTY_PATH, userDn,
                    password, new AuthenticatedLdapEntryContextCallback() {

                        @Override
                        public void executeWithContext(DirContext ctx,
                                LdapEntryIdentification ldapEntryIdentification) {
                            getAllRoles(user, userDn, result, userName, ctx);
View Full Code Here

TOP

Related Classes of org.springframework.ldap.core.AuthenticatedLdapEntryContextCallback

Copyright © 2018 www.massapicom. 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.