-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add policy module for ACL 1. Implemented basic policy storage & fundamental ACL features. 2. Upgraded hcl-rs to version 0.18 and implemented a format compatible with vault policy. 3. Fix the issue of the default functions exiting in the pre_auth and post_auth phases. 4. Add test cases for the policy module. 5. Fix the bugs where the test cases of the userpass and cert modules failed. 6. Add documentation and test cases for utils::string.
- Loading branch information
Showing
17 changed files
with
4,223 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,5 @@ | ||
pub use crate::utils::string::{ensure_no_leading_slash, ensure_no_trailing_slash, ensure_trailing_slash}; | ||
|
||
pub fn sanitize_path(s: &str) -> String { | ||
ensure_no_trailing_slash(&ensure_no_leading_slash(s)) | ||
} | ||
|
||
pub fn ensure_trailing_slash(s: &str) -> String { | ||
let s = s.trim(); | ||
if s.is_empty() { | ||
return String::new(); | ||
} | ||
|
||
let mut result = s.to_string(); | ||
while !result.is_empty() && !result.ends_with('/') { | ||
result.push('/'); | ||
} | ||
result | ||
} | ||
|
||
pub fn ensure_no_trailing_slash(s: &str) -> String { | ||
let s = s.trim(); | ||
if s.is_empty() { | ||
return String::new(); | ||
} | ||
|
||
let mut result = s.to_string(); | ||
while !result.is_empty() && result.ends_with('/') { | ||
result.pop(); | ||
} | ||
result | ||
} | ||
|
||
pub fn ensure_no_leading_slash(s: &str) -> String { | ||
let s = s.trim(); | ||
if s.is_empty() { | ||
return String::new(); | ||
} | ||
|
||
let mut result = s.to_string(); | ||
while !result.is_empty() && result.starts_with('/') { | ||
result.remove(0); | ||
} | ||
result | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.