mirror of
https://gitee.com/dromara/MaxKey.git
synced 2025-12-06 17:08:29 +08:00
/sign/authz/cas/v1/tickets这个接口只要用户名正确,密码随便填都能通过 #I7LC07
This commit is contained in:
parent
32462ebeef
commit
bf84b27fc0
@ -43,6 +43,7 @@ import org.springframework.http.HttpStatus;
|
|||||||
import org.springframework.http.MediaType;
|
import org.springframework.http.MediaType;
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.security.authentication.BadCredentialsException;
|
import org.springframework.security.authentication.BadCredentialsException;
|
||||||
|
import org.springframework.security.core.Authentication;
|
||||||
import org.springframework.security.core.AuthenticationException;
|
import org.springframework.security.core.AuthenticationException;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
@ -81,10 +82,14 @@ public class CasRestV1Endpoint extends CasBaseAuthorizeEndpoint{
|
|||||||
throw new BadCredentialsException("No credentials are provided or extracted to authenticate the REST request");
|
throw new BadCredentialsException("No credentials are provided or extracted to authenticate the REST request");
|
||||||
}
|
}
|
||||||
|
|
||||||
LoginCredential loginCredential =new LoginCredential(username,password,"CASREST");
|
LoginCredential loginCredential =new LoginCredential(username,password,"normal");
|
||||||
|
|
||||||
|
Authentication authentication = authenticationProvider.authenticate(loginCredential);
|
||||||
|
if(authentication == null) {
|
||||||
|
_logger.debug("Bad Credentials Exception");
|
||||||
|
return new ResponseEntity<>("Bad Credentials", HttpStatus.BAD_REQUEST);
|
||||||
|
}
|
||||||
|
|
||||||
authenticationProvider.authenticate(loginCredential,false);
|
|
||||||
|
|
||||||
TicketGrantingTicketImpl ticketGrantingTicket=new TicketGrantingTicketImpl("Random",AuthorizationUtils.getAuthentication(),null);
|
TicketGrantingTicketImpl ticketGrantingTicket=new TicketGrantingTicketImpl("Random",AuthorizationUtils.getAuthentication(),null);
|
||||||
|
|
||||||
String ticket=casTicketGrantingTicketServices.createTicket(ticketGrantingTicket);
|
String ticket=casTicketGrantingTicketServices.createTicket(ticketGrantingTicket);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user