Skip to content

Commit aa13be1

Browse files
check in wh_auth_base.h file
1 parent c64f0f2 commit aa13be1

1 file changed

Lines changed: 77 additions & 0 deletions

File tree

wolfhsm/wh_auth_base.h

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
/*
2+
* Copyright (C) 2025 wolfSSL Inc.
3+
*
4+
* This file is part of wolfHSM.
5+
*
6+
* wolfHSM is free software; you can redistribute it and/or modify
7+
* it under the terms of the GNU General Public License as published by
8+
* the Free Software Foundation; either version 3 of the License, or
9+
* (at your option) any later version.
10+
*
11+
* wolfHSM is distributed in the hope that it will be useful,
12+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+
* GNU General Public License for more details.
15+
*
16+
* You should have received a copy of the GNU General Public License
17+
* along with wolfHSM. If not, see <http://www.gnu.org/licenses/>.
18+
*/
19+
/*
20+
* wolfhsm/wh_auth_base.h
21+
*
22+
* Basic authentication and authorization implementation.
23+
*/
24+
25+
#ifndef WOLFHSM_WH_AUTH_BASE_H_
26+
#define WOLFHSM_WH_AUTH_BASE_H_
27+
28+
/* Pick up compile-time configuration */
29+
#include "wolfhsm/wh_settings.h"
30+
31+
#include <stdint.h>
32+
33+
#include "wolfhsm/wh_common.h"
34+
#include "wolfhsm/wh_auth.h"
35+
36+
37+
int wh_AuthBase_Init(void* context, const void *config);
38+
39+
int wh_AuthBase_Cleanup(void* context);
40+
41+
int wh_AuthBase_Login(void* context, uint8_t client_id,
42+
whAuthMethod method, const char* username,
43+
const void* auth_data,
44+
uint16_t auth_data_len,
45+
uint16_t* out_user_id,
46+
whAuthPermissions* out_permissions,
47+
int* loggedIn);
48+
49+
int wh_AuthBase_Logout(void* context, uint16_t current_user_id, uint16_t user_id);
50+
51+
52+
int wh_AuthBase_CheckRequestAuthorization(void* context,
53+
uint16_t user_id, uint16_t group, uint16_t action);
54+
55+
/* authorization check on key usage after the request has been parsed and before
56+
* the action is done */
57+
int wh_AuthBase_CheckKeyAuthorization(void* context, uint16_t user_id,
58+
uint32_t key_id, uint16_t action);
59+
60+
int wh_AuthBase_UserAdd(void* context, const char* username,
61+
uint16_t* out_user_id, whAuthPermissions permissions,
62+
whAuthMethod method, const void* credentials, uint16_t credentials_len);
63+
64+
int wh_AuthBase_UserDelete(void* context, uint16_t current_user_id, uint16_t user_id);
65+
66+
int wh_AuthBase_UserSetPermissions(void* context, uint16_t current_user_id,
67+
uint16_t user_id, whAuthPermissions permissions);
68+
69+
int wh_AuthBase_UserGet(void* context, const char* username, uint16_t* out_user_id,
70+
whAuthPermissions* out_permissions);
71+
72+
int wh_AuthBase_UserSetCredentials(void* context, uint16_t user_id,
73+
whAuthMethod method,
74+
const void* current_credentials, uint16_t current_credentials_len,
75+
const void* new_credentials, uint16_t new_credentials_len);
76+
77+
#endif /* WOLFHSM_WH_AUTH_BASE_H_ */

0 commit comments

Comments
 (0)