pub struct SqlIdentityBuilder { /* fields omitted */ }
Creates a new SqlIdentityBuilder that constructs a SqlIdentityPolicy
uri
- Database connection string
use actix_web::App;
use actix_web::middleware::identity::IdentityService;
use actix_web_sql_identity::SqlIdentityBuilder;
let policy = SqlIdentityBuilder::new("postgres://user:pass@host/database")
.pool_size(5)
.response_header("X-MY-RESPONSE")
.finish()
.expect("failed to open database");
let app = App::new().middleware(IdentityService::new(
policy
));
Change the response header when an identity is remembered
hdr
- Response header name to use
Change how many SQL connections are in each pool
count
- Number of connections per pool
Finish building this SQL identity policy. This will attempt
to construct the a pool of connections to the database
specified. The type of database is determined by the uri set.
On success, a new SqlIdentityPolicy is returned, on failure
an error is returned.
Forces a SQLite identity policy to be created. This function does
not normally need to be used, new
will automatically determine
the appropriate variant by parsing the connection string. This function
exists if the parsing fails
Forces a MySQL identity policy to be created. This function does
not normally need to be used, new
will automatically determine
the appropriate variant by parsing the connection string. This function
exists if the parsing fails
Forces a PostgreSQL identity policy to be created. This function does
not normally need to be used, new
will automatically determine
the appropriate variant by parsing the connection string. This function
exists if the parsing fails
Performs copy-assignment from source
. Read more