Package com.atlassian.oauth.util
Class RequestAnnotations
java.lang.Object
com.atlassian.oauth.util.RequestAnnotations
Managed annotations on the request to mark certain information to downstream parties
- Since:
- 1.2
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringgetOAuthConsumerKey(jakarta.servlet.http.HttpServletRequest req) Gets the consumer key that the given OAuth request has been authenticated on.static booleanisOAuthRequest(jakarta.servlet.http.HttpServletRequest req) static voidmarkAsOAuthRequest(jakarta.servlet.http.HttpServletRequest req) Annotates the servlet request as one having been authenticated via OAuth.static voidsetOAuthConsumerKey(jakarta.servlet.http.HttpServletRequest req, String consumerKey) Annotates the servlet request as one having been authenticated via OAuth using the consumerKey given.
-
Constructor Details
-
RequestAnnotations
public RequestAnnotations()
-
-
Method Details
-
isOAuthRequest
public static boolean isOAuthRequest(jakarta.servlet.http.HttpServletRequest req) throws NullPointerException - Parameters:
req- The servlet request to test, cannot be null;- Returns:
- If the request was authenticated via OAuth
- Throws:
NullPointerException- If the req variable is null
-
markAsOAuthRequest
public static void markAsOAuthRequest(jakarta.servlet.http.HttpServletRequest req) throws NullPointerException Annotates the servlet request as one having been authenticated via OAuth. Subsequent calls on the same request will have the same result.- Parameters:
req- The servlet request to annotate- Throws:
NullPointerException- If the req variable is null
-
getOAuthConsumerKey
Gets the consumer key that the given OAuth request has been authenticated on. Calling this method on a non-OAuth request will result inIllegalStateException. If unsure, simply callisOAuthRequest(jakarta.servlet.http.HttpServletRequest)beforehand.- Parameters:
req- the servlet request- Returns:
- consumer key
- Since:
- 1.6
-
setOAuthConsumerKey
public static void setOAuthConsumerKey(jakarta.servlet.http.HttpServletRequest req, String consumerKey) Annotates the servlet request as one having been authenticated via OAuth using the consumerKey given.- Parameters:
req- the servlet requestconsumerKey- consumer key that the request has been authenticated on- Since:
- 1.6
-