1 /* 2 * Copyright © 2015-2018 Aeneas Rekkas <aeneas+oss@aeneas.io> 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 * 16 * @author Aeneas Rekkas <aeneas+oss@aeneas.io> 17 * @copyright 2015-2018 Aeneas Rekkas <aeneas+oss@aeneas.io> 18 * @license Apache-2.0 19 * 20 */ 21 22 package oauth2 23 24 import ( 25 "context" 26 ) 27 28 // TokenRevocationStorage provides the storage implementation 29 // as specified in: https://tools.ietf.org/html/rfc7009 30 type TokenRevocationStorage interface { 31 RefreshTokenStorage 32 AccessTokenStorage 33 34 // RevokeRefreshToken revokes a refresh token as specified in: 35 // https://tools.ietf.org/html/rfc7009#section-2.1 36 // If the particular 37 // token is a refresh token and the authorization server supports the 38 // revocation of access tokens, then the authorization server SHOULD 39 // also invalidate all access tokens based on the same authorization 40 // grant (see Implementation Note). 41 RevokeRefreshToken(ctx context.Context, requestID string) error 42 43 // RevokeRefreshTokenMaybeGracePeriod revokes a refresh token as specified in: 44 // https://tools.ietf.org/html/rfc7009#section-2.1 45 // If the particular 46 // token is a refresh token and the authorization server supports the 47 // revocation of access tokens, then the authorization server SHOULD 48 // also invalidate all access tokens based on the same authorization 49 // grant (see Implementation Note). 50 // 51 // If the Refresh Token grace period is greater than zero in configuration the token 52 // will have its expiration time set as UTCNow + GracePeriod. 53 RevokeRefreshTokenMaybeGracePeriod(ctx context.Context, requestID string, signature string) error 54 55 // RevokeAccessToken revokes an access token as specified in: 56 // https://tools.ietf.org/html/rfc7009#section-2.1 57 // If the token passed to the request 58 // is an access token, the server MAY revoke the respective refresh 59 // token as well. 60 RevokeAccessToken(ctx context.Context, requestID string) error 61 } 62