uoa-repository-manager-service/src/main/java/eu/dnetlib/repo/manager/service/security/RoleMappingService.java

48 lines
1.5 KiB
Java
Raw Normal View History

2021-07-21 13:51:18 +02:00
package eu.dnetlib.repo.manager.service.security;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.authority.SimpleGrantedAuthority;
import java.util.Collection;
public interface RoleMappingService {
/**
* @param roleId Role Id
* @return Converts {@param roleId} to a repo Id.
*/
2023-02-17 15:17:37 +01:00
String getRepositoryId(String roleId);
2021-07-21 13:51:18 +02:00
/**
* @param roleIds Collection of roles
* @return Converts {@param roleIds} to a repo Ids.
*/
2023-02-17 15:17:37 +01:00
Collection<String> getRepositoryIds(Collection<String> roleIds);
2021-07-21 13:51:18 +02:00
/**
* @param repoId Repository Id
* @return Converts {@param repoId} to a role Id.
*/
2023-02-17 15:17:37 +01:00
String getRole(String repoId);
2021-07-21 13:51:18 +02:00
/**
* @param repoIds Collection of Repository Ids
* @return Converts {@param repoIds} to role Ids.
*/
2023-02-17 15:17:37 +01:00
Collection<String> getRoles(Collection<String> repoIds);
2021-07-21 13:51:18 +02:00
/**
2023-02-17 15:17:37 +01:00
* @param authority {@link GrantedAuthority}
* @return Converts {@param authority} to repository Id.
2021-07-21 13:51:18 +02:00
*/
2023-02-17 15:17:37 +01:00
String authorityToRepositoryId(GrantedAuthority authority);
2021-07-21 13:51:18 +02:00
/**
* @param repoId Repository Id
* @return Converts {@param repoId} to {@link SimpleGrantedAuthority} with the role url encoded ($ -> %24)
* // TODO: remove role encoding and perform url decoding when mapping authorities. (Must be performed in all OpenAIRE projects because of Redis)
*/
2023-02-17 15:17:37 +01:00
GrantedAuthority repositoryIdToAuthority(String repoId);
2021-07-21 13:51:18 +02:00
}