lighttpd 1.4.x
https://www.lighttpd.net/
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
101 lines
2.9 KiB
101 lines
2.9 KiB
1 year ago
|
/*
|
||
|
* mod_auth_api - HTTP auth backend registration, low-level shared funcs
|
||
|
*
|
||
|
* Fully-rewritten from original
|
||
|
* Copyright(c) 2016 Glenn Strauss gstrauss()gluelogic.com All rights reserved
|
||
|
* License: BSD 3-clause (same as lighttpd)
|
||
|
*/
|
||
|
#ifndef INCLUDED_MOD_AUTH_API_H
|
||
|
#define INCLUDED_MOD_AUTH_API_H
|
||
6 years ago
|
#include "first.h"
|
||
18 years ago
|
|
||
4 years ago
|
#include "base_decls.h"
|
||
|
#include "buffer.h"
|
||
|
#include "array.h"
|
||
18 years ago
|
|
||
1 year ago
|
__attribute_cold__
|
||
6 years ago
|
void http_auth_dumbdata_reset (void);
|
||
|
|
||
3 years ago
|
typedef enum http_auth_digest_type {
|
||
|
HTTP_AUTH_DIGEST_NONE = 0
|
||
|
,HTTP_AUTH_DIGEST_SESS = 0x01
|
||
|
,HTTP_AUTH_DIGEST_MD5 = 0x02
|
||
|
,HTTP_AUTH_DIGEST_SHA256 = 0x04
|
||
|
,HTTP_AUTH_DIGEST_SHA512_256 = 0x08
|
||
|
} http_auth_digest_type;
|
||
|
|
||
|
#define HTTP_AUTH_DIGEST_MD5_BINLEN 16 /* MD5_DIGEST_LENGTH */
|
||
|
#define HTTP_AUTH_DIGEST_SHA256_BINLEN 32 /* SHA256_DIGEST_LENGTH */
|
||
|
#define HTTP_AUTH_DIGEST_SHA512_256_BINLEN 32 /* SHA512_256_DIGEST_LENGTH */
|
||
|
|
||
1 year ago
|
__attribute_const__
|
||
3 years ago
|
unsigned int http_auth_digest_len (int algo);
|
||
|
|
||
6 years ago
|
struct http_auth_scheme_t;
|
||
|
struct http_auth_require_t;
|
||
|
struct http_auth_backend_t;
|
||
|
|
||
|
typedef struct http_auth_require_t {
|
||
|
const struct http_auth_scheme_t *scheme;
|
||
3 years ago
|
const buffer *realm;
|
||
2 years ago
|
const buffer *nonce_secret;
|
||
6 years ago
|
int valid_user;
|
||
3 years ago
|
int algorithm;
|
||
3 years ago
|
array user;
|
||
|
array group;
|
||
|
array host;
|
||
6 years ago
|
} http_auth_require_t;
|
||
|
|
||
1 year ago
|
__attribute_cold__
|
||
1 year ago
|
__attribute_malloc__
|
||
6 years ago
|
http_auth_require_t * http_auth_require_init (void);
|
||
1 year ago
|
|
||
|
__attribute_cold__
|
||
6 years ago
|
void http_auth_require_free (http_auth_require_t *require);
|
||
1 year ago
|
|
||
1 year ago
|
__attribute_pure__
|
||
6 years ago
|
int http_auth_match_rules (const http_auth_require_t *require, const char *user, const char *group, const char *host);
|
||
|
|
||
3 years ago
|
typedef struct http_auth_info_t {
|
||
|
int dalgo;
|
||
|
unsigned int dlen;
|
||
|
const char *username;
|
||
|
size_t ulen;
|
||
|
const char *realm;
|
||
|
size_t rlen;
|
||
|
/*(must be >= largest binary digest length accepted above)*/
|
||
|
unsigned char digest[32];
|
||
|
} http_auth_info_t;
|
||
|
|
||
6 years ago
|
typedef struct http_auth_backend_t {
|
||
|
const char *name;
|
||
3 years ago
|
handler_t(*basic)(request_st *r, void *p_d, const http_auth_require_t *require, const buffer *username, const char *pw);
|
||
|
handler_t(*digest)(request_st *r, void *p_d, http_auth_info_t *ai);
|
||
6 years ago
|
void *p_d;
|
||
|
} http_auth_backend_t;
|
||
![]()
16 years ago
|
|
||
6 years ago
|
typedef struct http_auth_scheme_t {
|
||
|
const char *name;
|
||
3 years ago
|
handler_t(*checkfn)(request_st *r, void *p_d, const struct http_auth_require_t *require, const struct http_auth_backend_t *backend);
|
||
6 years ago
|
/*(backend is arg only because auth.backend is separate config directive)*/
|
||
|
void *p_d;
|
||
|
} http_auth_scheme_t;
|
||
|
|
||
1 year ago
|
__attribute_cold__
|
||
1 year ago
|
__attribute_pure__
|
||
6 years ago
|
const http_auth_scheme_t * http_auth_scheme_get (const buffer *name);
|
||
1 year ago
|
|
||
|
__attribute_cold__
|
||
6 years ago
|
void http_auth_scheme_set (const http_auth_scheme_t *scheme);
|
||
1 year ago
|
|
||
|
__attribute_cold__
|
||
1 year ago
|
__attribute_pure__
|
||
6 years ago
|
const http_auth_backend_t * http_auth_backend_get (const buffer *name);
|
||
1 year ago
|
|
||
|
__attribute_cold__
|
||
6 years ago
|
void http_auth_backend_set (const http_auth_backend_t *backend);
|
||
3 years ago
|
|
||
3 years ago
|
void http_auth_setenv(request_st *r, const char *username, size_t ulen, const char *auth_type, size_t alen);
|
||
6 years ago
|
|
||
18 years ago
|
#endif
|