Fixed TokenController

Signed-off-by: Marcin Woźniak <y0rune@aol.com>
This commit is contained in:
Marcin Woźniak 2020-12-03 17:14:39 +01:00
parent f4db74b899
commit b897fce416
Signed by: y0rune
GPG Key ID: F204C385F57EB348

View File

@ -4,7 +4,7 @@ import com.plannaplan.entities.User;
import com.plannaplan.exceptions.UserNotFoundException;
import com.plannaplan.security.cas.CasUserIdentity;
import com.plannaplan.security.cas.CasValidationExcepiton;
import com.plannaplan.security.cas.DefaultUAMCasValidator;
import com.plannaplan.security.cas.CustomUAMCasValidator;
import com.plannaplan.services.UserService;
import org.springframework.beans.factory.annotation.Autowired;
@ -24,7 +24,7 @@ import io.swagger.annotations.ApiParam;
@Api(tags = { "Token" }, value = "Token", description = "Enpoints to get authorization.")
public class TokenController {
private final static String SERVICE_URL = "http://localhost:3000";
private final static String SERVICE_URL = "https://wmi.plannaplan.pl";
@Autowired
private UserService userService;
@ -32,8 +32,8 @@ public class TokenController {
@GetMapping("/token")
@ApiOperation(value = "Endpoint to access token required to call secured endpoints. In order to access token we need to provide access token comming from unviersity CAS system")
public ResponseEntity<String> getToken(
@RequestParam("ticket") @ApiParam(value = "Ticket get from CAS system. It should look like ST-1376572-wo41gty5R0JCZFKMMie2-cas.amu.edu.pl") final String ticket) {
final DefaultUAMCasValidator validator = new DefaultUAMCasValidator(SERVICE_URL, ticket);
@RequestParam("ticket") @ApiParam(value = "Ticket get from CAS system. It should look like ST-1376572-wo41gty5R0JCZFKMMie2-cas.amu.edu.psl") final String ticket) {
final CustomUAMCasValidator validator = new CustomUAMCasValidator(SERVICE_URL, ticket);
try {
final CasUserIdentity casUserIdentity = validator.validate();