Project

General

Profile

1
package eu.dnetlib.repo.manager.service.security;
2

    
3
import org.springframework.security.core.GrantedAuthority;
4
import org.springframework.security.core.authority.SimpleGrantedAuthority;
5

    
6
public interface RoleMappingService {
7

    
8
    /**
9
     * @param fullName
10
     * @param prefix
11
     * @return
12
     */
13
    String getRepoNameWithoutType(String fullName, String prefix);
14

    
15
    /**
16
     * @param roleId Role Id
17
     * @return Converts {@param roleId} to a repo Id.
18
     */
19
    String getRepoIdByRoleId(String roleId);
20

    
21
    /**
22
     * @param repoId Repository Id
23
     * @return Converts {@param repoId} to a role Id.
24
     */
25
    String getRoleIdByRepoId(String repoId);
26

    
27
    /**
28
     * @param authorityId Authority Id
29
     * @return Converts {@param authorityId} to repo Id.
30
     */
31
    String convertAuthorityIdToRepoId(String authorityId);
32

    
33
    /**
34
     * @param authority Granted authority
35
     * @return Converts {@param authority} to repo Id.
36
     */
37
    String convertAuthorityToRepoId(GrantedAuthority authority);
38

    
39
    /**
40
     * @param repoId Repository Id
41
     * @return
42
     */
43
    String convertRepoIdToAuthorityId(String repoId);
44

    
45
    /**
46
     * @param repoId Repository Id
47
     * @return Converts {@param repoId} to {@link String} role id url encoded ($ -> %24)
48
     * // TODO: remove role encoding and perform url decoding when mapping authorities. (Must be performed in all OpenAIRE projects because of Redis)
49
     */
50
    String convertRepoIdToEncodedAuthorityId(String repoId);
51

    
52
    /**
53
     * @param repoId Repository Id
54
     * @return Converts {@param repoId} to {@link SimpleGrantedAuthority} with the role url encoded ($ -> %24)
55
     * // TODO: remove role encoding and perform url decoding when mapping authorities. (Must be performed in all OpenAIRE projects because of Redis)
56
     */
57
    SimpleGrantedAuthority convertRepoIdToAuthority(String repoId);
58

    
59
}
(6-6/6)