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