Skip to content

webserver.auth.session #

fn new #

fn new(config SessionConfig) !SessionAuth

fn new_database_backend #

fn new_database_backend(config DatabaseBackendConfig) !DatabaseBackend

fn sqlite_database_backend #

fn sqlite_database_backend(db sqlite.DB) !DatabaseBackend

struct Client #

struct Client {
	url string
}

fn (Client) get_session #

fn (c Client) get_session(session_id string) !Session

struct DatabaseBackendConfig #

@[params]
struct DatabaseBackendConfig {
	db_path string = 'session_authenticator.sqlite'
mut:
	// db     sqlite.DB
	logger &log.Logger = &log.Logger(&log.Log{
	level: .info
})
}

struct SessionAuth #

struct SessionAuth {
mut:
	backend DatabaseBackend
}

fn (SessionAuth) create_session #

fn (mut s SessionAuth) create_session(user_id string) Session

fn (SessionAuth) get_session #

fn (mut s SessionAuth) get_session(id string) ?Session

struct SessionConfig #

@[params]
struct SessionConfig {
	backend ?DatabaseBackend
}