}
DLLIST_PREPEND(&db->head, req);
}
+
+bool db_oauth2_uses_password_grant(const struct db_oauth2 *db)
+{
+ return db->set.use_grant_password;
+}
void db_oauth2_ref(struct db_oauth2 *);
void db_oauth2_unref(struct db_oauth2 **);
+bool db_oauth2_uses_password_grant(const struct db_oauth2 *db);
+
void db_oauth2_lookup(struct db_oauth2 *db, struct db_oauth2_request *req, const char *token, struct auth_request *request, db_oauth2_lookup_callback_t *callback, void *context);
#define db_oauth2_lookup(db, req, token, request, callback, context) \
db_oauth2_lookup(db, req, token + \
else if (result != PASSDB_RESULT_OK)
auth_request_log_info(request, AUTH_SUBSYS_DB, "oauth2 failed: %s",
error);
+ else {
+ auth_request_set_field(request, "token", req->token, "PLAIN");
+ }
req->verify_callback(result, request);
auth_request_unref(&request);
}
module = p_new(pool, struct oauth2_passdb_module, 1);
module->db = db_oauth2_init(args);
+ module->module.default_pass_scheme = "PLAIN";
+
+ if (db_oauth2_uses_password_grant(module->db)) {
+ module->module.default_cache_key = "%u";
+ } else {
+ module->module.default_cache_key = "%u%w";
+ }
+
return &module->module;
}