Debian Codegraph @

src/main/org/h2/api/UserToRolesMapper.java

raw
1 /*
2 * Copyright 2004-2023 H2 Group. Multiple-Licensed under the MPL 2.0,
3 * and the EPL 1.0 (https://h2database.com/html/license.html).
4 * Initial Developer: Alessandro Ventura
5 */
6 package org.h2.api;
7
8 import java.util.Collection;
9
10 import org.h2.security.auth.AuthenticationException;
11 import org.h2.security.auth.AuthenticationInfo;
12 import org.h2.security.auth.Configurable;
13
14 /**
15 * A class that implement this interface can be used during authentication to
16 * map external users to database roles.
17 * <p>
18 * <b>This feature is experimental and subject to change</b>
19 * </p>
20 */
21 public interface UserToRolesMapper extends Configurable {
22
23 /**
24 * Map user identified by authentication info to a set of granted roles.
25 *
26 * @param authenticationInfo
27 * authentication information
28 * @return list of roles to be assigned to the user temporary
29 * @throws AuthenticationException
30 * on authentication exception
31 */
32 Collection<String> mapUserToRoles(AuthenticationInfo authenticationInfo) throws AuthenticationException;
33 }