Updated
Signed-off-by: Marcin Woźniak <y0rune@aol.com>
This commit is contained in:
parent
6dfb99f253
commit
616f782155
@ -4,7 +4,9 @@ import com.plannaplan.entities.User;
|
|||||||
import com.plannaplan.exceptions.UserNotFoundException;
|
import com.plannaplan.exceptions.UserNotFoundException;
|
||||||
import com.plannaplan.security.cas.CasUserIdentity;
|
import com.plannaplan.security.cas.CasUserIdentity;
|
||||||
import com.plannaplan.security.cas.CasValidationExcepiton;
|
import com.plannaplan.security.cas.CasValidationExcepiton;
|
||||||
|
import com.plannaplan.security.cas.CasValidator;
|
||||||
import com.plannaplan.security.cas.CustomUAMCasValidator;
|
import com.plannaplan.security.cas.CustomUAMCasValidator;
|
||||||
|
import com.plannaplan.security.cas.DefaultUAMCasValidator;
|
||||||
import com.plannaplan.services.UserService;
|
import com.plannaplan.services.UserService;
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@ -26,7 +28,10 @@ import io.swagger.annotations.ApiParam;
|
|||||||
public class TokenController {
|
public class TokenController {
|
||||||
|
|
||||||
@Value("${plannaplan.frontendUrl}")
|
@Value("${plannaplan.frontendUrl}")
|
||||||
private String SERVICE_URL;
|
private String serviceUrl;
|
||||||
|
|
||||||
|
@Value("${plannaplan.dev}")
|
||||||
|
private boolean isDev;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private UserService userService;
|
private UserService userService;
|
||||||
@ -35,7 +40,7 @@ public class TokenController {
|
|||||||
@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")
|
@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(
|
public ResponseEntity<String> getToken(
|
||||||
@RequestParam("ticket") @ApiParam(value = "Ticket get from CAS system. It should look like ST-1376572-wo41gty5R0JCZFKMMie2-cas.amu.edu.psl") final String 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);
|
final CasValidator validator = isDev ? new DefaultUAMCasValidator(serviceUrl, ticket) : new CustomUAMCasValidator(serviceUrl, ticket);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
final CasUserIdentity casUserIdentity = validator.validate();
|
final CasUserIdentity casUserIdentity = validator.validate();
|
||||||
|
@ -11,4 +11,5 @@ spring.jackson.default-property-inclusion = NON_NULL
|
|||||||
|
|
||||||
server.port=1285
|
server.port=1285
|
||||||
|
|
||||||
|
plannaplan.dev = true
|
||||||
plannaplan.frontendUrl = http://localhost:3000
|
plannaplan.frontendUrl = http://localhost:3000
|
Loading…
Reference in New Issue
Block a user