providers/session: Fix session cookie, make it more secure
This commit is contained in:
		
							parent
							
								
									2d5dbc50b3
								
							
						
					
					
						commit
						b9d55ad0b6
					
				@ -108,11 +108,16 @@ func (this *state) funcSessionHTTP (
 | 
			
		||||
		result = session
 | 
			
		||||
	}
 | 
			
		||||
	cookie := &http.Cookie {
 | 
			
		||||
		Name:    sessionIDCookieName,
 | 
			
		||||
		Value:   result.ID().String(),
 | 
			
		||||
		Expires: expiration,
 | 
			
		||||
		Name:     sessionIDCookieName,
 | 
			
		||||
		Value:    result.ID().String(),
 | 
			
		||||
		Expires:  expiration,
 | 
			
		||||
		Secure:   true,
 | 
			
		||||
		HttpOnly: true,
 | 
			
		||||
		SameSite: http.SameSiteStrictMode,
 | 
			
		||||
		Path:     "/",
 | 
			
		||||
	}
 | 
			
		||||
	http.SetCookie(shttp.UnderlyingResponseWriter(res), cookie)
 | 
			
		||||
	underlyingRes := shttp.UnderlyingResponseWriter(res)
 | 
			
		||||
	http.SetCookie(underlyingRes, cookie)
 | 
			
		||||
	return result, nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user