blob: 37e209d8fc20b32dfff03e128f24153522b28d36 [file] [log] [blame]
Simon Hunt1169c952017-06-05 11:20:11 -07001/*
2 * Copyright 2017-present Open Networking Laboratory
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 */
17
18package org.onosproject.ui;
19
20/**
21 * Service for handling UI session tokens.
22 */
23public interface UiTokenService {
24
25 /**
26 * Issues a session token. The service will generate a new token,
27 * publish it in the distributed map of valid UI session tokens, and
28 * return it to the caller.
29 *
30 * @param username the username to be associated with the token.
31 * @return the token
32 */
33 UiSessionToken issueToken(String username);
34
35 /**
36 * Revokes the specified session token. The service will remove the token
37 * from the distributed map of valid UI session tokens.
38 *
39 * @param token the token to be revoked
40 */
41 void revokeToken(UiSessionToken token);
42
43 /**
44 * Returns true if the specified token is currently in the distributed
45 * map of valid UI session tokens.
46 *
47 * @param token the token to check
48 * @return true, if the token is currently valid; false otherwise
49 */
50 boolean isTokenValid(UiSessionToken token);
51}