Skip to content

Package: AccessTokenService

AccessTokenService

Coverage

1: /*******************************************************************************
2: * Copyright (c) 2016, 2022 Eurotech and/or its affiliates and others
3: *
4: * This program and the accompanying materials are made
5: * available under the terms of the Eclipse Public License 2.0
6: * which is available at https://www.eclipse.org/legal/epl-2.0/
7: *
8: * SPDX-License-Identifier: EPL-2.0
9: *
10: * Contributors:
11: * Eurotech - initial API and implementation
12: *******************************************************************************/
13: package org.eclipse.kapua.service.authentication.token;
14:
15: import org.eclipse.kapua.KapuaException;
16: import org.eclipse.kapua.model.id.KapuaId;
17: import org.eclipse.kapua.service.KapuaEntityService;
18: import org.eclipse.kapua.service.KapuaUpdatableEntityService;
19: import org.eclipse.kapua.service.authentication.AuthenticationService;
20:
21: /**
22: * Access token service API
23: *
24: * @since 1.0
25: */
26: public interface AccessTokenService extends KapuaEntityService<AccessToken, AccessTokenCreator>, KapuaUpdatableEntityService<AccessToken> {
27:
28: /**
29: * Find all access token associated with the given userId.
30: *
31: * @param scopeId
32: * @param userId
33: * @return
34: * @throws KapuaException
35: * @since 1.0
36: */
37: AccessTokenListResult findByUserId(KapuaId scopeId, KapuaId userId) throws KapuaException;
38:
39: /**
40: * Find the access token by the given tokenId.
41: *
42: * @param tokenId
43: * @return
44: * @throws KapuaException
45: * @since 1.0
46: */
47: AccessToken findByTokenId(String tokenId) throws KapuaException;
48:
49: /**
50: * Invalidated the {@link AccessToken} by its id. After calling this method the token will be no longer valid and a new
51: * {@link AuthenticationService#login(org.eclipse.kapua.service.authentication.LoginCredentials)} invocation is required in order to get a new valid {@link AccessToken}.
52: *
53: * @param scopeId The {@link KapuaId} scopeId of the {@link AccessToken} to delete.
54: * @param id The {@link KapuaId} of the {@link AccessToken} to delete.
55: * @since 1.0
56: */
57: void invalidate(KapuaId scopeId, KapuaId id) throws KapuaException;
58: }