How to set expire_in in OAUTH 2.0?

后端 未结 8 2054
醉梦人生
醉梦人生 2020-12-28 15:58

I am using OAuth 2.0 with spring for token generation and I want to set expire_in manually so token can expire as per my criteria. Any one help me?

8条回答
  •  独厮守ぢ
    2020-12-28 16:11

    public interface OAuth2AccessToken {
    
        public static String BEARER_TYPE = "Bearer";
    
        public static String OAUTH2_TYPE = "OAuth2";
    
        /**
         * The access token issued by the authorization server. This value is REQUIRED.
         */
        public static String ACCESS_TOKEN = "access_token";
    
        /**
         * The type of the token issued as described in Section 7.1. Value is case insensitive.
         * This value is REQUIRED.
         */
        public static String TOKEN_TYPE = "token_type";
    
        /**
         * The lifetime in seconds of the access token. For example, the value "3600" denotes that the access token will
         * expire in one hour from the time the response was generated. This value is OPTIONAL.
         */
        public static String EXPIRES_IN = "expires_in";
    
        /**
         * The refresh token which can be used to obtain new access tokens using the same authorization grant as described
         * in Section 6. This value is OPTIONAL.
         */
        public static String REFRESH_TOKEN = "refresh_token";
    
        /**
         * The scope of the access token as described by Section 3.3
         */
        public static String SCOPE = "scope";
    
        /**
         * The additionalInformation map is used by the token serializers to export any fields used by extensions of OAuth.
         * @return a map from the field name in the serialized token to the value to be exported. The default serializers 
         * make use of Jackson's automatic JSON mapping for Java objects (for the Token Endpoint flows) or implicitly call 
         * .toString() on the "value" object (for the implicit flow) as part of the serialization process.
         */
        Map getAdditionalInformation();
    
        Set getScope();
    
        OAuth2RefreshToken getRefreshToken();
    
        String getTokenType();
    
        boolean isExpired();
    
        Date getExpiration();
    
        int getExpiresIn();
    
        String getValue();
    
    }
    

提交回复
热议问题