@FunctionalInterface public interface OwncloudGrantedAuthoritiesMapper
GrantedAuthoritiesMapper.
If you want to implement any GrantedAuthority based on the User then any Implementation of GrantedAuthoritiesMapper
will be of no use because GrantedAuthoritiesMapper.mapAuthorities(Collection) only gets a Collection of GrantedAuthority.
By implementing this Interface you also get the Username of the authenticated Owncloud User as a Decision Base for the granted Authorities.
So you can implement the following Authentication-Structure (based on Spring Security JDBC):
+-------------+ +--------------+
| Users | | Authorities |
+-------------+ +--------------+
| PK username | | PK authority |
+-------------+ +--------------+
| |
+--------+-------+ +--------+-------+
/|\ /|\ /|\ /|\
+-----------------+ +-----------------+ +------------------+
| Memberships | | UserAuthorities | | GroupAuthorities |
+-----------------+ +-----------------+ +------------------+
| PK FK username | | PK FK username | | PK FK groupname |
| PK FK groupname | | PK FK authority | | PK FK authority |
+-----------------+ +-----------------+ +------------------+
\|/ \|/
+---------------------+---------------------+
|
+--------------+
| Groups |
+--------------+
| PK groupname |
+--------------+
Whereas the Tables Users, Groups and Memberships are implemented by Owncloud.
So, in simple Words, by implementing this Interface as a Service you can put the Authorities of your own Application into the
OwncloudUserDetails Object returned by the OwncloudRestUserDetailsServiceImpl.loadUserByUsername(String)GrantedAuthoritiesMapper| Modifier and Type | Method and Description |
|---|---|
Collection<? extends org.springframework.security.core.GrantedAuthority> |
mapAuthorities(String username,
Collection<? extends org.springframework.security.core.GrantedAuthority> grantedAuthorities) |
Collection<? extends org.springframework.security.core.GrantedAuthority> mapAuthorities(String username, Collection<? extends org.springframework.security.core.GrantedAuthority> grantedAuthorities)
Copyright © 2016–2020 coolstuff.software. All rights reserved.