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 fosite 23 24 import ( 25 "context" 26 "time" 27 ) 28 29 // ClientManager defines the (persistent) manager interface for clients. 30 type ClientManager interface { 31 // GetClient loads the client by its ID or returns an error 32 // if the client does not exist or another error occurred. 33 GetClient(ctx context.Context, id string) (Client, error) 34 // ClientAssertionJWTValid returns an error if the JTI is 35 // known or the DB check failed and nil if the JTI is not known. 36 ClientAssertionJWTValid(ctx context.Context, jti string) error 37 // SetClientAssertionJWT marks a JTI as known for the given 38 // expiry time. Before inserting the new JTI, it will clean 39 // up any existing JTIs that have expired as those tokens can 40 // not be replayed due to the expiry. 41 SetClientAssertionJWT(ctx context.Context, jti string, exp time.Time) error 42 } 43