-
Notifications
You must be signed in to change notification settings - Fork 160
/
CredentialsFactory.java
73 lines (64 loc) · 2.39 KB
/
CredentialsFactory.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
/*******************************************************************************
* Copyright (c) 2011, 2020 Eurotech and/or its affiliates and others
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Eurotech - initial API and implementation
* Red Hat Inc
*******************************************************************************/
package org.eclipse.kapua.service.authentication;
import org.eclipse.kapua.model.KapuaObjectFactory;
/**
* {@link CredentialsFactory} factory definition.
*/
public interface CredentialsFactory extends KapuaObjectFactory {
/**
* Creates a new {@link UsernamePasswordCredentials} instance based on provided username and password
*
* @param username the name of the user
* @param password the password of the user
* @return the new credentials
*/
UsernamePasswordCredentials newUsernamePasswordCredentials(String username, String password);
/**
* Creates a new {@link UsernamePasswordCredentials} instance based on username and password with no preset values
*
* @return the new, empty credentials instance
*/
default UsernamePasswordCredentials newUsernamePasswordCredentials() {
return newUsernamePasswordCredentials(null, null);
}
/**
* Creates a new {@link ApiKeyCredentials} instance based on provided api key
*
* @param apiKey
* @return
*/
ApiKeyCredentials newApiKeyCredentials(String apiKey);
/**
* Creates a new {@link JwtCredentials} instance based on provided Json Web Token
*
* @param jwt
* @param idToken the OpenID Connect idToken, used for the logout
* @return
*/
JwtCredentials newJwtCredentials(String jwt, String idToken);
/**
* Creates a new {@link AccessTokenCredentials} instance based on provided tokenId
*
* @param tokenId
* @return
*/
AccessTokenCredentials newAccessTokenCredentials(String tokenId);
/**
* Creates a new {@link RefreshTokenCredentials} instance based on provided tokenId and refresh token
*
* @param tokenId
* @return
*/
RefreshTokenCredentials newRefreshTokenCredentials(String tokenId, String refreshToken);
}