Fixed bug in buildToken and buildUser.
This commit is contained in:
		@@ -207,6 +207,8 @@ public class NLSongsDB {
 | 
			
		||||
        return sql.updateCount }
 | 
			
		||||
 | 
			
		||||
    private static User buildUser(def row) {
 | 
			
		||||
        if (!row) return null
 | 
			
		||||
 | 
			
		||||
        User user = new User(username: row["username"], role: row["role"])
 | 
			
		||||
        user.@pwd = row["pwd"]
 | 
			
		||||
 | 
			
		||||
@@ -291,7 +293,10 @@ public class NLSongsDB {
 | 
			
		||||
        return record }
 | 
			
		||||
 | 
			
		||||
    private static Token buildToken(def row) {
 | 
			
		||||
        if (!row) return null
 | 
			
		||||
 | 
			
		||||
        User user = buildUser(row)
 | 
			
		||||
        assert user != null
 | 
			
		||||
 | 
			
		||||
        return new Token(
 | 
			
		||||
            token: row["token"], user: user, expires: row["expires"]) }
 | 
			
		||||
 
 | 
			
		||||
@@ -25,7 +25,7 @@ public class NLSongsSecurityContext implements SecurityContext {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public String getAuthenticationScheme() { return "Authentication-Token" }
 | 
			
		||||
    public String getAuthenticationScheme() { return "Authorization-Token" }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public Principal getUserPrincipal() { return principal }
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user