Skip to content

Commit 021df74

Browse files
committed
fix(sonar): simplify authentication response type
1 parent 059b93d commit 021df74

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

generators/spring-boot/templates/src/main/java/_package_/web/rest/AuthenticateController.java.ejs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -117,15 +117,15 @@ public class AuthenticateController {
117117
<%_ } _%>
118118

119119
/**
120-
* {@code GET /authenticate} : check if the user is authenticated, and return its login.
120+
* {@code GET /authenticate} : check if the user is authenticated, and return a boolean value.
121121
*
122122
* @param principal the authentication principal.
123-
* @return the login if the user is authenticated.
123+
* @return a boolean indicating if the user is authenticated.
124124
*/
125125
@GetMapping(value = "/authenticate", produces = MediaType.TEXT_PLAIN_VALUE)
126-
public String isAuthenticated(Principal principal) {
126+
public boolean isAuthenticated(Principal principal) {
127127
LOG.debug("REST request to check if the current user is authenticated");
128-
return principal == null ? null : principal.getName();
128+
return principal != null;
129129
}
130130

131131
public String createToken(Authentication authentication, boolean rememberMe) {

0 commit comments

Comments
 (0)