1 package com.atlassian.sal.api.auth;
2
3 import com.atlassian.sal.api.page.PageCapability;
4 import com.atlassian.sal.api.user.UserRole;
5
6 import java.net.URI;
7 import java.util.EnumSet;
8
9 /**
10 * Provides the {@code URI} to redirect users to for them to login before they can
11 * authorize consumer requests to access their data.
12 *
13 * @since 2.0
14 */
15 public interface LoginUriProvider {
16
17 /**
18 * Returns the {@code URI} to redirect users for login. It must append the {@code returnUri}
19 * so that once login is complete, the user will be redirected back to the original page.
20 *
21 * @param returnUri {@code URI} of the page the application should redirect the user to after login is complete
22 * @return the {@code URI} to redirect users for login
23 * @throws RuntimeException if the returnUri is not a valid URI, or cannot be url encoded properly
24 */
25 URI getLoginUri(URI returnUri);
26
27 /**
28 * Returns the {@code URI} to redirect users for login. It must append the {@code returnUri}
29 * so that once login is complete, the user will be redirected back to the original page.
30 *
31 * @param returnUri {@code URI} of the page the application should redirect the user to after login is complete
32 * @param pageCaps {@code PageCapability} for product to supply in login page.
33 * @return the {@code URI} to redirect users for login
34 * @throws RuntimeException if the returnUri is not a valid URI, or cannot be url encoded properly
35 */
36 URI getLoginUri(URI returnUri, EnumSet<PageCapability> pageCaps);
37
38 /**
39 * Returns the {@code URI} to redirect users for login. It must append the {@code returnUri}
40 * so that once login is complete, the user will be redirected back to the original page.
41 *
42 * Page is expected to redirect back to {@code URI} only if u
43 *
44 * @param returnUri {@code URI} of the page the application should redirect the user to after login is complete
45 * @param role {@code UserRole} of user
46 * @return the {@code URI} to redirect users for login
47 * @throws RuntimeException if the returnUri is not a valid URI, or cannot be url encoded properly
48 */
49 URI getLoginUriForRole(URI returnUri, UserRole role);
50
51 /**
52 * Returns the {@code URI} to redirect users for login. It must append the {@code returnUri}
53 * so that once login is complete, the user will be redirected back to the original page.
54 *
55 * Page is expected to redirect back to {@code URI} only if u
56 *
57 * This page is supposed to match requested {@code PageCapability}
58 *
59 * @param returnUri {@code URI} of the page the application should redirect the user to after login is complete
60 * @param role {@code UserRole} of user
61 * @param pageCaps {@code PageCapability} for product to supply in login page.
62 * @return the {@code URI} to redirect users for login
63 * @throws RuntimeException if the returnUri is not a valid URI, or cannot be url encoded properly
64 */
65 URI getLoginUriForRole(URI returnUri, UserRole role, EnumSet<PageCapability> pageCaps);
66 }