package org.neo4j.tutor.security;

import java.util.Collections;
import java.util.HashMap;
import java.util.Map;

import org.neo4j.api.core.Node;

public class AuthorizationService
{
	private static Map<Thread,Node> userMap =
		Collections.synchronizedMap( new HashMap<Thread,Node>() );
	
	public static void authenticate( Node user )
	{
		userMap.put( Thread.currentThread(), user );
	}
	
	public static Node unregisterUser()
	{
		return userMap.remove( Thread.currentThread() );
	}
	
	public static Node getCurrentUser()
	{
		return userMap.get( Thread.currentThread() );
	}
}
