Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(jans-cedarling): Policy Store: Parse Schema and Policies #9575

Merged
merged 18 commits into from
Sep 25, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
97ea92a
feat(jans-cedarling): add PolicyStore and field schema. Also added de…
olehbozhok Sep 23, 2024
7dac32a
test(jans-cedarling): add unit tests to check `parse_cedar_schema` (d…
olehbozhok Sep 23, 2024
e01bc54
docs(jans-cedarling): add docs for PolicyStore
olehbozhok Sep 23, 2024
928b2bd
feat(jans-cedarling): add loading policy store based on config
olehbozhok Sep 23, 2024
bd0df57
feat(jans-cedarling): add loading policy store to Cedarling
olehbozhok Sep 23, 2024
3449b60
chore(jans-cedarling): rename LogType to LogTypeConfig
olehbozhok Sep 23, 2024
821cc2e
chore(jans-cedarling): fix `log_init` example after updating config
olehbozhok Sep 23, 2024
5cd1c79
chore(jans-cedarling): add allow(dead_code) on schema
olehbozhok Sep 23, 2024
d29218e
chore(jans-cedarling): add copyright notice
olehbozhok Sep 23, 2024
6b4ed70
docs(jans-cedarling): add README to init module
olehbozhok Sep 23, 2024
a1163bd
docs(jans-cedarling): add README to authz module
olehbozhok Sep 23, 2024
8d8cf8b
chore(jans-cedarling): update message in ErrorLoadPolicyStore::MoreTh…
olehbozhok Sep 23, 2024
bf89da3
chore(jans-cedarling): add comments to Cedarling::new
olehbozhok Sep 23, 2024
b6dacac
chore(jans-cedarling): remove unnecessary code
olehbozhok Sep 23, 2024
8cd92b3
docs(jans-cedarling): in README removed `Cedarling bindings` section
olehbozhok Sep 24, 2024
e724090
chore(jans-cedarling): move position of PolicyStoreMap to be first
olehbozhok Sep 24, 2024
cf20191
chore(jans-cedarling): refactor, move errors messages to the enum
olehbozhok Sep 24, 2024
df19054
Merge branch 'main' into jans-cedaling-issue-9568
moabu Sep 25, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
chore(jans-cedarling): rename LogType to LogTypeConfig
Signed-off-by: Oleh Bohzok <olehbozhok@gmail.com>
  • Loading branch information
olehbozhok committed Sep 23, 2024
commit 3449b600664a80c1c8799c6d1239f28d0ce9ee8e
10 changes: 5 additions & 5 deletions jans-cedarling/cedarling/src/log/log_strategy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use super::memory_logger::MemoryLogger;
use super::nop_logger::NopLogger;
use super::stdout_logger::StdOutLogger;
use crate::models::log_config::LogConfig;
use crate::models::log_config::LogType;
use crate::models::log_config::LogTypeConfig;
use crate::models::log_entry::LogEntry;

/// LogStrategy implements strategy pattern for logging.
Expand All @@ -25,10 +25,10 @@ impl LogStrategy {
/// Initializes the corresponding logger accordingly.
pub fn new(config: LogConfig) -> Self {
match config.log_type {
LogType::Off => Self::OnlyWriter(Box::new(NopLogger)),
LogType::Memory(config) => Self::MemoryLogger(MemoryLogger::new(config)),
LogType::StdOut => Self::OnlyWriter(Box::new(StdOutLogger::new())),
LogType::Lock => todo!(),
LogTypeConfig::Off => Self::OnlyWriter(Box::new(NopLogger)),
LogTypeConfig::Memory(config) => Self::MemoryLogger(MemoryLogger::new(config)),
LogTypeConfig::StdOut => Self::OnlyWriter(Box::new(StdOutLogger::new())),
LogTypeConfig::Lock => todo!(),
}
}
}
Expand Down
8 changes: 4 additions & 4 deletions jans-cedarling/cedarling/src/log/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ use crate::models::log_config;
fn test_new_log_strategy_off() {
// Arrange
let config = LogConfig {
log_type: log_config::LogType::Off,
log_type: log_config::LogTypeConfig::Off,
};

// Act
Expand All @@ -37,7 +37,7 @@ fn test_new_log_strategy_off() {
fn test_new_log_strategy_memory() {
// Arrange
let config = LogConfig {
log_type: log_config::LogType::Memory(log_config::MemoryLogConfig { log_ttl: 60 }),
log_type: log_config::LogTypeConfig::Memory(log_config::MemoryLogConfig { log_ttl: 60 }),
};

// Act
Expand All @@ -51,7 +51,7 @@ fn test_new_log_strategy_memory() {
fn test_new_logstrategy_stdout() {
// Arrange
let config = LogConfig {
log_type: log_config::LogType::StdOut,
log_type: log_config::LogTypeConfig::StdOut,
};

// Act
Expand All @@ -65,7 +65,7 @@ fn test_new_logstrategy_stdout() {
fn test_log_memory_logger() {
// Arrange
let config = LogConfig {
log_type: log_config::LogType::Memory(log_config::MemoryLogConfig { log_ttl: 60 }),
log_type: log_config::LogTypeConfig::Memory(log_config::MemoryLogConfig { log_ttl: 60 }),
};
let strategy = LogStrategy::new(config);
let entry = LogEntry {
Expand Down
4 changes: 2 additions & 2 deletions jans-cedarling/cedarling/src/models/log_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@
/// A set of properties used to configure logging in the `Cedarling` application.
pub struct LogConfig {
/// `CEDARLING_LOG_TYPE` in [bootstrap properties](https://github.com/JanssenProject/jans/wiki/Cedarling-Nativity-Plan#bootstrap-properties) documentation.
pub log_type: LogType,
pub log_type: LogTypeConfig,
}

/// Log type configuration.
/// `CEDARLING_LOG_TYPE` in [bootstrap properties](https://github.com/JanssenProject/jans/wiki/Cedarling-Nativity-Plan#bootstrap-properties) documentation.
/// Current type represent this value.
#[derive(Debug, Clone, Copy)]
pub enum LogType {
pub enum LogTypeConfig {
/// Logger do nothing. It means that all logs will be ignored.
Off,
/// Logger holds all logs in database (in memory) with eviction policy.
Expand Down