Commit 3572d1f8 authored by Quxl's avatar Quxl

x

parent 2c722beb
...@@ -32,10 +32,14 @@ public interface OAuthApi { ...@@ -32,10 +32,14 @@ public interface OAuthApi {
final String OAUTH_TOKEN_SESSION = "OAUTH2_TOKEN_SESSION_KEY"; final String OAUTH_TOKEN_SESSION = "OAUTH2_TOKEN_SESSION_KEY";
default boolean isLogin() { default boolean isLogin() {
return getOAuthToken() != null;
}
default OAuthToken getOAuthToken() {
HttpServletRequest request = this.getHttpServletRequest(); HttpServletRequest request = this.getHttpServletRequest();
HttpSession session = request.getSession(); HttpSession session = request.getSession();
OAuthToken token = (OAuthToken)session.getAttribute(OAUTH_TOKEN_SESSION); OAuthToken token = (OAuthToken)session.getAttribute(OAUTH_TOKEN_SESSION);
return token != null; return token;
} }
default void toLogin() { default void toLogin() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment