Package edu.ksu.lti.launch.controller
Class OauthController
- java.lang.Object
-
- edu.ksu.lti.launch.controller.OauthController
-
@Controller public class OauthController extends Object
Controller for obtaining an oauth token for a user. It redirects the user to the Canvas oauth endpoint which requests the user's permission. Once they grant permission, a request comes back here with a "code" which is then used to make another request from the server to Canvas to verify things and finally get the actual token back.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static StringgetApplicationBaseUrl(javax.servlet.http.HttpServletRequest request, boolean includeLtiApp)Returns the base URL of this application.StringoauthResponse(javax.servlet.http.HttpServletRequest request, String oauthCode, String state, String errorMsg)StringstartOauth(javax.servlet.http.HttpServletRequest request)
-
-
-
Method Detail
-
startOauth
@RequestMapping("/beginOauth") public String startOauth(javax.servlet.http.HttpServletRequest request) throws NoLtiSessionException, CookieUnavailableException
-
oauthResponse
@RequestMapping("/oauthResponse") public String oauthResponse(javax.servlet.http.HttpServletRequest request, @ModelAttribute("code") String oauthCode, @ModelAttribute("state") String state, @ModelAttribute("error") String errorMsg) throws NoLtiSessionException- Throws:
NoLtiSessionException
-
getApplicationBaseUrl
public static String getApplicationBaseUrl(javax.servlet.http.HttpServletRequest request, boolean includeLtiApp)
Returns the base URL of this application. This includes scheme, hostname and port number. Useful for when you need an absolute URL pointing to something in this application but don't want to hard-code so it still works in alpha, beta and production. Does NOT include a trailing slash.- Parameters:
request- servlet requestincludeLtiApp- Specify whether to include the application context part of the URL (/bioDemo, /learnItLive, etc)- Returns:
- Base URL of this application
-
-