package com.vikram.configuration;

import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.web.util.WebUtils;

import com.vikram.openconnect.login.IAccessToken;

public class AccessToken implements IAccessToken {

	private static String COOKIE_NAME = "access_token";

	@Override
	public void setAccessToken(String accessToken, HttpServletResponse response) {
		response.addCookie(new Cookie(COOKIE_NAME,accessToken));	
	}

	@Override
	public String getAccessToken(HttpServletRequest request) {
		Cookie accessToken = WebUtils.getCookie(request, COOKIE_NAME);
		if(accessToken!=null){
			return accessToken.getValue();
		}
		return "";
	}

	
	

}

@@ -657,11 +657,15 @@
 ;%0A%09%09
-if(
+return 
 acce
@@ -675,27 +675,18 @@
 oken
-!
+=
 =null
-)%7B%0A%09%09%09return 
+?%22%22:
 acce
@@ -709,25 +709,8 @@
 ();%0A
-%09%09%7D%0A%09%09return %22%22;%0A
 %09%7D%0A%0A

Revert "Fix NPE"