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 /**
19 * Returns the {@code URI} to redirect users for login. It must append the {@code returnUri}
20 * so that once login is complete, the user will be redirected back to the original page.
21 *
22 * @param returnUri {@code URI} of the page the application should redirect the user to after login is complete
23 * @return the {@code URI} to redirect users for login
24 * @throws RuntimeException if the returnUri is not a valid URI, or cannot be url encoded properly
25 */
26 URI getLoginUri(URI returnUri);
27
28 /**
29 * Returns the {@code URI} to redirect users for login. It must append the {@code returnUri}
30 * so that once login is complete, the user will be redirected back to the original page.
31 *
32 * @param returnUri {@code URI} of the page the application should redirect the user to after login is complete
33 * @param pageCaps {@code PageCapability} for product to supply in login page.
34 * @return the {@code URI} to redirect users for login
35 * @throws RuntimeException if the returnUri is not a valid URI, or cannot be url encoded properly
36 */
37 URI getLoginUri(URI returnUri, EnumSet<PageCapability> pageCaps);
38
39 /**
40 * Returns the {@code URI} to redirect users for login. It must append the {@code returnUri}
41 * so that once login is complete, the user will be redirected back to the original page.
42 *
43 * Page is expected to redirect back to {@code URI} only if u
44 *
45 * @param returnUri {@code URI} of the page the application should redirect the user to after login is complete
46 * @param role {@code UserRole} of user
47 * @return the {@code URI} to redirect users for login
48 * @throws RuntimeException if the returnUri is not a valid URI, or cannot be url encoded properly
49 */
50 URI getLoginUriForRole(URI returnUri, UserRole role);
51
52 /**
53 * Returns the {@code URI} to redirect users for login. It must append the {@code returnUri}
54 * so that once login is complete, the user will be redirected back to the original page.
55 *
56 * Page is expected to redirect back to {@code URI} only if u
57 *
58 * This page is supposed to match requested {@code PageCapability}
59 *
60 * @param returnUri {@code URI} of the page the application should redirect the user to after login is complete
61 * @param role {@code UserRole} of user
62 * @param pageCaps {@code PageCapability} for product to supply in login page.
63 * @return the {@code URI} to redirect users for login
64 * @throws RuntimeException if the returnUri is not a valid URI, or cannot be url encoded properly
65 */
66 URI getLoginUriForRole(URI returnUri, UserRole role, EnumSet<PageCapability> pageCaps);
67 }