Skip to content

Package: AccessTokenService

AccessTokenService

Coverage

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