archiva-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r1439701 - in /archiva/redback/redback-core/trunk/redback-common/redback-common-ldap/src/main/java/org/apache/archiva/redback/common/ldap/role: DefaultLdapRoleMapperConfiguration.java LdapRoleMapperConfiguration.java
Date Mon, 28 Jan 2013 23:55:11 GMT
Author: olamy
Date: Mon Jan 28 23:55:10 2013
New Revision: 1439701

URL: http://svn.apache.org/viewvc?rev=1439701&view=rev
Log:
add classes

Added:
    archiva/redback/redback-core/trunk/redback-common/redback-common-ldap/src/main/java/org/apache/archiva/redback/common/ldap/role/DefaultLdapRoleMapperConfiguration.java
  (with props)
    archiva/redback/redback-core/trunk/redback-common/redback-common-ldap/src/main/java/org/apache/archiva/redback/common/ldap/role/LdapRoleMapperConfiguration.java
  (with props)

Added: archiva/redback/redback-core/trunk/redback-common/redback-common-ldap/src/main/java/org/apache/archiva/redback/common/ldap/role/DefaultLdapRoleMapperConfiguration.java
URL: http://svn.apache.org/viewvc/archiva/redback/redback-core/trunk/redback-common/redback-common-ldap/src/main/java/org/apache/archiva/redback/common/ldap/role/DefaultLdapRoleMapperConfiguration.java?rev=1439701&view=auto
==============================================================================
--- archiva/redback/redback-core/trunk/redback-common/redback-common-ldap/src/main/java/org/apache/archiva/redback/common/ldap/role/DefaultLdapRoleMapperConfiguration.java
(added)
+++ archiva/redback/redback-core/trunk/redback-common/redback-common-ldap/src/main/java/org/apache/archiva/redback/common/ldap/role/DefaultLdapRoleMapperConfiguration.java
Mon Jan 28 23:55:10 2013
@@ -0,0 +1,88 @@
+package org.apache.archiva.redback.common.ldap.role;
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import com.google.common.collect.ArrayListMultimap;
+import com.google.common.collect.Multimap;
+import org.apache.archiva.redback.common.ldap.MappingException;
+import org.apache.archiva.redback.configuration.UserConfiguration;
+import org.apache.archiva.redback.configuration.UserConfigurationKeys;
+import org.apache.commons.lang.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Service;
+
+import javax.inject.Inject;
+import javax.inject.Named;
+import java.util.Collection;
+import java.util.Map;
+
+/**
+ * @author Olivier Lamy
+ */
+@Service( "ldapRoleMapperConfiguration#default" )
+public class DefaultLdapRoleMapperConfiguration
+    implements LdapRoleMapperConfiguration
+{
+
+    private Logger log = LoggerFactory.getLogger( getClass() );
+
+    @Inject
+    @Named( value = "userConfiguration#default" )
+    private UserConfiguration userConf;
+
+    public void addLdapMapping( String role, String ldapGroup )
+    {
+        log.warn( "addLdapMapping not implemented" );
+    }
+
+    public void removeLdapMapping( String role )
+    {
+        log.warn( "removeLdapMapping not implemented" );
+    }
+
+    public void setLdapGroupMappings( Map<String, Collection<String>> mappings
)
+        throws MappingException
+    {
+        log.warn( "setLdapGroupMappings not implemented" );
+    }
+
+    public Map<String, Collection<String>> getLdapGroupMappings()
+    {
+        Multimap<String, String> map = ArrayListMultimap.create();
+
+        Collection<String> keys = userConf.getKeys();
+
+        for ( String key : keys )
+        {
+            if ( key.startsWith( UserConfigurationKeys.LDAP_GROUPS_ROLE_START_KEY ) )
+            {
+                String val = userConf.getString( key );
+                String[] roles = StringUtils.split( val, ',' );
+                for ( String role : roles )
+                {
+                    map.put( StringUtils.substringAfter( key, UserConfigurationKeys.LDAP_GROUPS_ROLE_START_KEY
),
+                             role );
+                }
+            }
+        }
+
+        return map.asMap();
+    }
+}

Propchange: archiva/redback/redback-core/trunk/redback-common/redback-common-ldap/src/main/java/org/apache/archiva/redback/common/ldap/role/DefaultLdapRoleMapperConfiguration.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: archiva/redback/redback-core/trunk/redback-common/redback-common-ldap/src/main/java/org/apache/archiva/redback/common/ldap/role/DefaultLdapRoleMapperConfiguration.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: archiva/redback/redback-core/trunk/redback-common/redback-common-ldap/src/main/java/org/apache/archiva/redback/common/ldap/role/LdapRoleMapperConfiguration.java
URL: http://svn.apache.org/viewvc/archiva/redback/redback-core/trunk/redback-common/redback-common-ldap/src/main/java/org/apache/archiva/redback/common/ldap/role/LdapRoleMapperConfiguration.java?rev=1439701&view=auto
==============================================================================
--- archiva/redback/redback-core/trunk/redback-common/redback-common-ldap/src/main/java/org/apache/archiva/redback/common/ldap/role/LdapRoleMapperConfiguration.java
(added)
+++ archiva/redback/redback-core/trunk/redback-common/redback-common-ldap/src/main/java/org/apache/archiva/redback/common/ldap/role/LdapRoleMapperConfiguration.java
Mon Jan 28 23:55:10 2013
@@ -0,0 +1,57 @@
+package org.apache.archiva.redback.common.ldap.role;
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.archiva.redback.common.ldap.MappingException;
+
+import java.util.Collection;
+import java.util.Map;
+
+/**
+ * @author Olivier Lamy
+ * @since 2.1
+ */
+public interface LdapRoleMapperConfiguration
+{
+    /**
+     * add mapping redback role <-> ldap group
+     *
+     * @param role      redback role
+     * @param ldapGroup ldap group
+     */
+    void addLdapMapping( String role, String ldapGroup )
+        throws MappingException;
+
+    /**
+     * remove a mapping
+     *
+     * @param role redback role
+     */
+    void removeLdapMapping( String role )
+        throws MappingException;
+
+    /**
+     * @return Map of corresponding LDAP group (key) and Redback roles (value)
+     */
+    Map<String, Collection<String>> getLdapGroupMappings()
+        throws MappingException;
+
+    void setLdapGroupMappings( Map<String, Collection<String>> mappings )
+        throws MappingException;
+}

Propchange: archiva/redback/redback-core/trunk/redback-common/redback-common-ldap/src/main/java/org/apache/archiva/redback/common/ldap/role/LdapRoleMapperConfiguration.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: archiva/redback/redback-core/trunk/redback-common/redback-common-ldap/src/main/java/org/apache/archiva/redback/common/ldap/role/LdapRoleMapperConfiguration.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision



Mime
View raw message