fixed some issue for the token authorization #87
@ -10,7 +10,6 @@ import ovh.herisson.Clyde.Tables.Token;
 | 
			
		||||
 | 
			
		||||
@RestController
 | 
			
		||||
@CrossOrigin(origins = "http://localhost:5173")
 | 
			
		||||
| 
					
	
	
	
	
	
	
	
	 | 
			||||
 | 
			
		||||
public class TokenController {
 | 
			
		||||
 | 
			
		||||
    private final TokenService tokenServ;
 | 
			
		||||
 | 
			
		||||
@ -23,14 +23,10 @@ public class UserController {
 | 
			
		||||||
    }
 | 
			
		||||||
 | 
			
		||||||
    @GetMapping("/user")
 | 
			
		||||||
    public ResponseEntity<User> getUser(@RequestHeader("Cookie") String cookie){
 | 
			
		||||||
        String[] tokens = cookie.split("=",2);
 | 
			
		||||||
        if (! tokens[0].equals("session_token") || tokens[1].length() != 64)
 | 
			
		||||||
        {
 | 
			
		||||||
            return  new UnauthorizedResponse<>(null);
 | 
			
		||||||
        }
 | 
			
		||||||
        System.out.println(tokens[1]);
 | 
			
		||||||
        User user = authServ.getUserFromToken(tokens[1]);
 | 
			
		||||||
    public ResponseEntity<User> getUser(@RequestHeader("Cookie") String authorization){
 | 
			
		||||||
| 
					
	
	
	
	
	
	
	
	 
				
					
						tonitch
						commented  
			
		Pourquoi le passage à Coookie ? Pourquoi le passage à Coookie ?  
			
			
		
				
					
						tonitch
						commented  
			
		
		frontend/src/rest/restConsumer.js
		Line 35 in 8fdfb470cb
	 
	
 https://git.herisson.ovh/PGL/Clyde/src/commit/8fdfb470cb3c130f0d0e3bde1adc9b7e4edb1981/frontend/src/rest/restConsumer.js#L35
 
			
			
		 | 
			||||||
 | 
			
		||||||
        if (authorization == null) return new UnauthorizedResponse<>(null);
 | 
			
		||||||
        User user = authServ.getUserFromToken(authorization);
 | 
			
		||||||
        if (user == null) return new UnauthorizedResponse<>(null);
 | 
			
		||||||
        return new ResponseEntity<>(user, HttpStatus.OK);
 | 
			
		||||||
    }
 | 
			
		||||||
 | 
			
		||||||
		Reference in New Issue
	
	Block a user
	
Dans le dernier pr j'ai fait un petit changement au cross origin. Pour l'instant c'est bon mais c'est juste pour attirer l'attention sur ça !