-
Notifications
You must be signed in to change notification settings - Fork 642
Expand file tree
/
Copy pathAuthInterface.java
More file actions
147 lines (132 loc) · 6.07 KB
/
AuthInterface.java
File metadata and controls
147 lines (132 loc) · 6.07 KB
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
package org.bimserver.shared.interfaces;
/******************************************************************************
* Copyright (C) 2009-2019 BIMserver.org
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see {@literal<http://www.gnu.org/licenses/>}.
*****************************************************************************/
import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;
import javax.jws.soap.SOAPBinding.ParameterStyle;
import javax.jws.soap.SOAPBinding.Style;
import javax.jws.soap.SOAPBinding.Use;
import org.bimserver.interfaces.objects.SAccessMethod;
import org.bimserver.interfaces.objects.SUser;
import org.bimserver.shared.exceptions.ServerException;
import org.bimserver.shared.exceptions.UserException;
@WebService(name = "AuthInterface", targetNamespace="org.bimserver")
@SOAPBinding(style = Style.DOCUMENT, use = Use.LITERAL, parameterStyle = ParameterStyle.WRAPPED)
public interface AuthInterface extends PublicInterface {
/**
* Login with a username/password combination
*
* @param username The username (must be a valid e-mail address)
* @param password The password
* @return A token, use this token in subsequent calls. Read the documentation of the transport
* mechanism (SOAP, Protocol Buffers or JSON) to see how to send the token
* @throws ServerException, UserException
*/
@WebMethod(action = "login")
String login(
@WebParam(name = "username", partName = "login.username") String username,
@WebParam(name = "password", partName = "login.password") String password) throws ServerException, UserException;
/**
* Logout
*
* @throws ServerException, UserException
*/
@WebMethod(action = "logout")
void logout() throws ServerException, UserException;
/**
* Check whether the server considers the user (token) as logged-in
*
* @return Whether this ServiceInterface is logged-in
* @throws ServerException, UserException
*/
@WebMethod(action = "isLoggedIn")
Boolean isLoggedIn() throws ServerException, UserException;
/**
* @return The method of access this ServiceInterface is using (SOAP, PB etc...)
* @throws ServerException, UserException
*/
@WebMethod(action = "getAccessMethod")
SAccessMethod getAccessMethod() throws ServerException, UserException;
/**
* Login with a user-token
*
* @param token The token to login with
* @return A token, use this token in subsequent calls. Read the documentation of the transport
* mechanism (SOAP, Protocol Buffers or JSON) to see how to send the token
* @throws ServerException
* @throws UserException
*/
@WebMethod(action = "loginUserToken")
String loginUserToken(
@WebParam(name = "token", partName = "loginUserToken.token") String token) throws ServerException, UserException;
/**
* @return The User that it currently logged in on this ServiceInterface
* @throws ServerException, UserException
*/
@WebMethod(action = "getLoggedInUser")
SUser getLoggedInUser() throws ServerException, UserException;
/**
* Change a User's password, not the preferred way, use requestPasswordChange for a safer version
* @param uoid The ObjectID of the User
* @param oldPassword The old password
* @param newPassword The new password
* @return Whether the password was successfully changed
* @throws ServerException, UserException
*/
@WebMethod(action = "changePassword")
Boolean changePassword(
@WebParam(name = "uoid", partName = "changePassword.uoid") Long uoid,
@WebParam(name = "oldPassword", partName = "changePassword.oldPassword") String oldPassword,
@WebParam(name = "newPassword", partName = "changePassword.newPassword") String newPassword) throws ServerException, UserException;
/**
* Set password hash and salt for a user's password
* @param uoid The ObjectID of the user
* @throws ServerException, UserException
*/
@WebMethod(action = "setHash")
void setHash(
@WebParam(name = "uoid", partName = "setHash.uoid") Long uoid,
@WebParam(name = "hash", partName = "setHash.hash") byte[] hash,
@WebParam(name = "salt", partName = "setHash.salt") byte[] salt) throws ServerException, UserException;
/**
* Request a password change, an e-mail will be sent with a validation url
* @param username The username of the user to change the password for
* @throws ServerException, UserException
*/
@WebMethod(action = "requestPasswordChange")
void requestPasswordChange(
@WebParam(name = "username", partName = "requestPasswordChange.username") String username,
@WebParam(name = "resetUrl", partName = "requestPasswordChange.resetUrl") String resetUrl,
@WebParam(name = "includeSiteAddress", partName = "requestPasswordChange.includeSiteAddress") Boolean includeSiteAddress) throws ServerException, UserException;
// @WebMethod(action = "createToken")
// String createToken(
// @WebParam(name = "validitySeconds", partName = "createToken.validitySeconds") Integer validitySeconds) throws UserException, ServerException;
/**
* @param uoid The ObejctID of the User
* @param token The token generated by requestPasswordChange
* @param password The new password
* @return A User object if the change is successful, null otherwise
* @throws ServerException, UserException
*/
@WebMethod(action = "validateAccount")
SUser validateAccount(
@WebParam(name = "uoid", partName = "validateAccount.uoid") Long uoid,
@WebParam(name = "token", partName = "validateAccount.token") String token,
@WebParam(name = "password", partName = "validateAccount.password") String password) throws ServerException, UserException;
}