-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
54 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
backend/src/main/java/org/ftclub/cabinet/openpublic/controller/LoginController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package org.ftclub.cabinet.openpublic.controller; | ||
|
||
import java.io.IOException; | ||
import javax.servlet.http.HttpServletRequest; | ||
import javax.servlet.http.HttpServletResponse; | ||
import lombok.RequiredArgsConstructor; | ||
import org.ftclub.cabinet.alarm.config.AlarmProperties; | ||
import org.ftclub.cabinet.auth.service.AuthFacadeService; | ||
import org.ftclub.cabinet.log.Logging; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
@Logging | ||
@RequiredArgsConstructor | ||
@RequestMapping("/public") | ||
@RestController | ||
public class LoginController { | ||
|
||
private final AuthFacadeService authFacadeService; | ||
private final AlarmProperties alarmProperties; | ||
|
||
@GetMapping("/login") | ||
public void login(HttpServletRequest request, HttpServletResponse response) throws IOException { | ||
final String username = "anonymous"; | ||
if (!alarmProperties.getIsProduction()) { | ||
authFacadeService.handlePublicLogin(request, response, username); | ||
} | ||
} | ||
} |