mirror of
				https://git.haproxy.org/git/haproxy.git/
				synced 2025-11-04 10:31:14 +01:00 
			
		
		
		
	The STATS_DEFAULT_REALM and STATS_DEFAULT_URI were moved to defaults.h. It was required to include types/pattern.h and types/sample.h since they are mentioned in function prototypes. It would be wise to merge this with uri_auth.h later.
		
			
				
	
	
		
			75 lines
		
	
	
		
			2.8 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			75 lines
		
	
	
		
			2.8 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
/*
 | 
						|
 * URI-based user authentication using the HTTP basic method.
 | 
						|
 *
 | 
						|
 * Copyright 2006-2011 Willy Tarreau <w@1wt.eu>
 | 
						|
 *
 | 
						|
 * This program is free software; you can redistribute it and/or
 | 
						|
 * modify it under the terms of the GNU General Public License
 | 
						|
 * as published by the Free Software Foundation; either version
 | 
						|
 * 2 of the License, or (at your option) any later version.
 | 
						|
 *
 | 
						|
 */
 | 
						|
 | 
						|
#ifndef _COMMON_URI_AUTH_H
 | 
						|
#define _COMMON_URI_AUTH_H
 | 
						|
 | 
						|
 | 
						|
#include <haproxy/auth-t.h>
 | 
						|
#include <haproxy/api.h>
 | 
						|
 | 
						|
/* This is a list of proxies we are allowed to see. Later, it should go in the
 | 
						|
 * user list, but before this we need to support de/re-authentication.
 | 
						|
 */
 | 
						|
struct stat_scope {
 | 
						|
	struct stat_scope *next;	/* next entry, NULL if none */
 | 
						|
	int px_len;			/* proxy name length */
 | 
						|
	char *px_id;			/* proxy id */
 | 
						|
};
 | 
						|
 | 
						|
/* later we may link them to support multiple URI matching */
 | 
						|
struct uri_auth {
 | 
						|
	int uri_len;			/* the prefix length */
 | 
						|
	char *uri_prefix;		/* the prefix we want to match */
 | 
						|
	char *auth_realm;		/* the realm reported to the client */
 | 
						|
	char *node, *desc;		/* node name & description reported in this stats */
 | 
						|
	int refresh;			/* refresh interval for the browser (in seconds) */
 | 
						|
	unsigned int flags;		/* STAT_* flags from stats.h and for applet.ctx.stats.flags */
 | 
						|
	struct stat_scope *scope;	/* linked list of authorized proxies */
 | 
						|
	struct userlist *userlist;	/* private userlist to emulate legacy "stats auth user:password" */
 | 
						|
	struct list http_req_rules;	/* stats http-request rules : allow/deny/auth */
 | 
						|
	struct list admin_rules;	/* 'stats admin' rules (chained) */
 | 
						|
	struct uri_auth *next;		/* Used at deinit() to build a list of unique elements */
 | 
						|
};
 | 
						|
 | 
						|
struct stats_admin_rule {
 | 
						|
	struct list list;	/* list linked to from the proxy */
 | 
						|
	struct acl_cond *cond;	/* acl condition to meet */
 | 
						|
};
 | 
						|
 | 
						|
 | 
						|
/* Various functions used to set the fields during the configuration parsing.
 | 
						|
 * Please that all those function can initialize the root entry in order not to
 | 
						|
 * force the user to respect a certain order in the configuration file.
 | 
						|
 *
 | 
						|
 * Default values are used during initialization. Check STATS_DEFAULT_* for
 | 
						|
 * more information.
 | 
						|
 */
 | 
						|
struct uri_auth *stats_check_init_uri_auth(struct uri_auth **root);
 | 
						|
struct uri_auth *stats_set_uri(struct uri_auth **root, char *uri);
 | 
						|
struct uri_auth *stats_set_realm(struct uri_auth **root, char *realm);
 | 
						|
struct uri_auth *stats_set_refresh(struct uri_auth **root, int interval);
 | 
						|
struct uri_auth *stats_set_flag(struct uri_auth **root, int flag);
 | 
						|
struct uri_auth *stats_add_auth(struct uri_auth **root, char *user);
 | 
						|
struct uri_auth *stats_add_scope(struct uri_auth **root, char *scope);
 | 
						|
struct uri_auth *stats_set_node(struct uri_auth **root, char *name);
 | 
						|
struct uri_auth *stats_set_desc(struct uri_auth **root, char *desc);
 | 
						|
 | 
						|
#endif /* _COMMON_URI_AUTH_H */
 | 
						|
 | 
						|
/*
 | 
						|
 * Local variables:
 | 
						|
 *  c-indent-level: 8
 | 
						|
 *  c-basic-offset: 8
 | 
						|
 * End:
 | 
						|
 */
 |