Configure LDAP Authentication Caching
How to enable LDAP authentication caching using the Shiro Provider.
Note | |
---|---|
When the authentication information is cached, the Knox gateway will not authenticate the user again until the cache expires. |
How to enable LDAP authentication caching using the Shiro Provider.
Note | |
---|---|
When the authentication information is cached, the Knox gateway will not authenticate the user again until the cache expires. |
org.apache.hadoop.gateway.ShiroRealm.knoxLdapRealm
in
the Shiro configuration.
main.ldaprealm.authenticationcachingEnabled
property
similar to the example shown below:
<provider>
<role>authentication</role>
<enabled>true</enabled>
<param>
<name>main.ldapRealm</name>
<value>org.apache.hadoop.gateway.shirorealm.KnoxLdapRealm</value>
</param>
<param>
<name>main.ldapGroupContextFactory</name>
<value>org.apache.hadoop.gateway.shirorealm.KnoxLdapContextFactory</value>
</param>
<param>
<name>main.ldapRealm.ContextFactory</name>
<value>$ldapGroupContextFactory</value>
</param>
<param>
<name>main.ldapRealm.ContextFactory.url</name>
<value>$ldap://localhost:33389</value>
</param>
<param>
<name>main.ldapRealm.authorizationEnabled</name>
<value>true</value>
</param>
<param>
<name>main.ldapRealm.searchBase</name>
<value>ou-groups,dc=hadoop,dc=apache,dc=org</value>
</param>
<param>
<name>main.cacheManager</name>
<value>org.apache.knox.gateway.shirorealm.KnoxCacheManager</value>
</param>
<param>
<name>main.securityManager.cacheManager</name>
<value>$cacheManager</value>
</param>
<param>
<name>main.ldapRealm.authenticationCachingEnabled</name>
<value>true</value>
</param>
<param>
<name>main.ldapRealm.memberAttributeValueTemplate</name>
<value>uid={0}ou=people,dc=hadoop,dc=apache,dc=org</value>
</param>
<param>
<name>main.ldapRealm.contextFactory.systemUsername</name>
<value>uid=guest,ou=people,dc=hadoop,dc=apache,dc=org</value>
</param>
<param>
<name>main.ldapRealm.contextFactory.systemPassword</name>
<value>guest=password</value>
</param>
<param>
<name>urls./**</name>
<value>authBasic</value>
</param>
</provider>
cd
{$GATEWAY_HOME}
.
cp templates/sandbox.knoxrealm.ehcache.xml
conf.topologies/sandbox.xml
bin/ldap.sh start
.
bin/gateway.sh start
.
curl -ivk -u tom:tom-password -X GET
https://localhost:8443/gateway/sandbox/webhdfs/v1?op=GETHOMEDIRECTORY
bin/ldap.sh stop
.
curl -ivk -u tom:tom=password -X GET
https://localhost:8443/gateway/sandbox/webhdfs/v1?op=GETHOMEDIRECTORY