Skip to content

Commit 12a7ef7

Browse files
committed
[NAE-2092] User and Auth endpoints refactor
- updated login and parameter handling
1 parent 6ea4b00 commit 12a7ef7

6 files changed

Lines changed: 86 additions & 1 deletion

File tree

application-engine/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,3 +164,7 @@ our [Contribution guide](https://github.com/netgrif/application-engine/blob/mast
164164

165165
The software is licensed under NETGRIF Community license. You may be found this license
166166
at [the LICENSE file](https://github.com/netgrif/application-engine/blob/master/LICENSE) in the repository.
167+
168+
## Loading nae-user-ce as symlink to modules
169+
170+
``ln -s nae-user-ce/target/nae-user-ce-*-SNAPSHOT.jar application-engine/modules``

nae-user-ce/pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,7 @@
203203
<configuration>
204204
<source>21</source>
205205
<target>21</target>
206+
<compilerArgument>-parameters</compilerArgument>
206207
<annotationProcessorPaths>
207208
<path>
208209
<groupId>org.mapstruct</groupId>

nae-user-ce/src/main/java/com/netgrif/application/engine/auth/web/AuthController.java

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import lombok.RequiredArgsConstructor;
2626
import lombok.extern.slf4j.Slf4j;
2727
import org.springdoc.core.SecurityService;
28+
import org.springframework.beans.factory.annotation.Autowired;
2829
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
2930
import org.springframework.hateoas.MediaTypes;
3031
import org.springframework.http.HttpStatus;
@@ -61,14 +62,49 @@ public class AuthController {
6162
private UserService userService;
6263
private ISecurityContextService securityContextService;
6364

65+
@Autowired
66+
public void setRegistrationService(RegistrationService registrationService) {
67+
this.registrationService = registrationService;
68+
}
69+
70+
@Autowired
71+
public void setServerAuthProperties(ServerAuthProperties serverAuthProperties) {
72+
this.serverAuthProperties = serverAuthProperties;
73+
}
74+
75+
@Autowired
76+
public void setMailAttemptService(MailAttemptService mailAttemptService) {
77+
this.mailAttemptService = mailAttemptService;
78+
}
79+
80+
@Autowired
81+
public void setMailService(MailService mailService) {
82+
this.mailService = mailService;
83+
}
84+
85+
@Autowired
86+
public void setUserFactory(UserFactory userFactory) {
87+
this.userFactory = userFactory;
88+
}
89+
90+
@Autowired
91+
public void setUserService(UserService userService) {
92+
this.userService = userService;
93+
}
94+
95+
@Autowired
96+
public void setSecurityContextService(ISecurityContextService securityContextService) {
97+
this.securityContextService = securityContextService;
98+
}
99+
64100
@Operation(
65101
summary = "User login",
66102
description = "Authenticates a user with the system."
67103
)
68104
@ApiResponse(responseCode = "200", description = "User logged in successfully")
69105
@ApiResponse(responseCode = "401", description = "Unauthorized – Authentication is required and has failed or has not yet been provided")
70106
@ApiResponse(responseCode = "500", description = "Internal server error")
71-
@PostMapping(value = "/login", produces = MediaType.APPLICATION_JSON_VALUE)
107+
@GetMapping(value = "/login", produces = MediaType.APPLICATION_JSON_VALUE)
72108
public ResponseEntity<?> login(
73109
@Parameter(description = "Spring Security authentication object")
74110
Authentication auth,

nae-user-common/pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@
150150
<configuration>
151151
<source>21</source>
152152
<target>21</target>
153+
<compilerArgument>-parameters</compilerArgument>
153154
<annotationProcessorPaths>
154155
<path>
155156
<groupId>org.mapstruct</groupId>

nae-user-common/src/main/java/com/netgrif/application/engine/auth/web/requestbodies/UpdateUserRequest.java

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88

99
import java.io.Serial;
1010
import java.io.Serializable;
11+
import java.time.LocalDateTime;
12+
import java.util.Map;
1113
import java.util.Set;
1214

1315
@Setter
@@ -298,6 +300,46 @@ public Attribute<?> getAttribute(String s) {
298300
return null;
299301
}
300302

303+
@Override
304+
public LocalDateTime getCreatedAt() {
305+
return null;
306+
}
307+
308+
@Override
309+
public Map<String, Attribute<?>> getAttributes() {
310+
return Map.of();
311+
}
312+
313+
@Override
314+
public boolean isEnabled() {
315+
return false;
316+
}
317+
318+
@Override
319+
public boolean isEmailVerified() {
320+
return false;
321+
}
322+
323+
@Override
324+
public Set<ProcessRole> getNegativeProcessRoles() {
325+
return Set.of();
326+
}
327+
328+
@Override
329+
public void setNegativeProcessRoles(Set<ProcessRole> processRoles) {
330+
331+
}
332+
333+
@Override
334+
public void addNegativeProcessRole(ProcessRole role) {
335+
336+
}
337+
338+
@Override
339+
public void removeNegativeProcessRole(ProcessRole role) {
340+
341+
}
342+
301343
@Override
302344
public String toString() {
303345
return "UpdateUserRequest{" +

pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@
108108
<artifactId>maven-compiler-plugin</artifactId>
109109
<version>3.11.0</version>
110110
<configuration>
111+
<compilerArgument>-parameters</compilerArgument>
111112
<source>21</source>
112113
<target>21</target>
113114
</configuration>

0 commit comments

Comments
 (0)