Skip to content

Package: AccessTokenCreator

AccessTokenCreator

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.model.KapuaEntityCreator;
16: import org.eclipse.kapua.model.id.KapuaId;
17:
18: import javax.xml.bind.annotation.XmlAccessType;
19: import javax.xml.bind.annotation.XmlAccessorType;
20: import javax.xml.bind.annotation.XmlElement;
21: import javax.xml.bind.annotation.XmlRootElement;
22: import javax.xml.bind.annotation.XmlType;
23: import java.util.Date;
24:
25: /**
26: * Access token creator service definition
27: *
28: * @since 1.0
29: */
30: @XmlRootElement
31: @XmlAccessorType(XmlAccessType.FIELD)
32: @XmlType(propOrder = { "tokenId",
33: "userId",
34: "expiresOn",
35: "refreshToken",
36: "refreshExpiresOn"
37: }, //
38: factoryClass = AccessTokenXmlRegistry.class, //
39: factoryMethod = "newAccessTokenCreator")
40: public interface AccessTokenCreator extends KapuaEntityCreator<AccessToken> {
41:
42: /**
43: * Gets the token id
44: *
45: * @return The token id
46: * @since 1.0
47: */
48: @XmlElement(name = "tokenId")
49: String getTokenId();
50:
51: /**
52: * Sets the token id
53: *
54: * @param tokenId the token id to set
55: * @since 1.0
56: */
57: void setTokenId(String tokenId);
58:
59: /**
60: * Gets the user id owner of this token
61: *
62: * @return The user id owner of this token
63: * @since 1.0
64: */
65: @XmlElement(name = "userId")
66: KapuaId getUserId();
67:
68: /**
69: * Sets the user id owner of this token.
70: *
71: * @param userId The user id owner of this token.
72: * @since 1.0
73: */
74: void setUserId(KapuaId userId);
75:
76: /**
77: * Gets the expire date of this token.
78: *
79: * @return The expire date of this token.
80: * @since 1.0
81: */
82: @XmlElement(name = "expiresOn")
83: Date getExpiresOn();
84:
85: /**
86: * Sets the expire date of this token.
87: *
88: * @param expiresOn The expire date of this token.
89: * @since 1.0
90: */
91: void setExpiresOn(Date expiresOn);
92:
93: /**
94: * Gets the refresh token to obtain a new {@link AccessToken} after expiration.
95: *
96: * @since 1.0
97: */
98: @XmlElement(name = "refreshToken")
99: String getRefreshToken();
100:
101: /**
102: * Sets the refresh token to obtain a new {@link AccessToken} after expiration.
103: *
104: * @param refreshToken The refresh token
105: * @since 1.0
106: */
107: void setRefreshToken(String refreshToken);
108:
109: /**
110: * Gets the expiration date of the refresh token.
111: *
112: * @since 1.0
113: */
114: @XmlElement(name = "refreshExpiresOn")
115: Date getRefreshExpiresOn();
116:
117: /**
118: * Sets the expire date of this token.
119: *
120: * @param refreshExpiresOn The expiration date of the refresh token.
121: * @since 1.0
122: */
123: void setRefreshExpiresOn(Date refreshExpiresOn);
124: }