mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
vweb: adding a vweb.csrf protection module (#15586)
This commit is contained in:
30
vlib/vweb/csrf/structs.v
Normal file
30
vlib/vweb/csrf/structs.v
Normal file
@@ -0,0 +1,30 @@
|
||||
// This module provides csrf-protection for apps written with libe vweb.
|
||||
|
||||
module csrf
|
||||
|
||||
import vweb
|
||||
import net.http
|
||||
|
||||
type CsrfCookie = http.Cookie
|
||||
|
||||
interface CheckedApp {}
|
||||
|
||||
pub struct App {
|
||||
vweb.Context
|
||||
csrf_cookie_value string
|
||||
}
|
||||
|
||||
pub struct HttpOnly {
|
||||
http_only bool
|
||||
}
|
||||
|
||||
struct CsrfError {
|
||||
Error
|
||||
m string
|
||||
}
|
||||
|
||||
fn (err CsrfError) msg() string {
|
||||
return err.m
|
||||
}
|
||||
|
||||
// Written by flopetautschnig (floscodes) 2022
|
||||
Reference in New Issue
Block a user