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
@Service | |
public class AccessControlService { | |
public boolean verifyUserModuleAccess(String user, ModuleEnum moduleEnum) { | |
//Rule for User and Module access | |
return true; | |
} | |
} |
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
@Component | |
@Aspect | |
public class SecurityAspectConfig { | |
private final AccessControlService accessControlService; | |
public SecurityAspectConfig(AccessControlService accessControlService) { | |
this.accessControlService = accessControlService; | |
} |
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
@RestController | |
@RequestMapping("/api/v1/payments") | |
public class PaymentsController implements ModuleSecurity { | |
@GetMapping | |
public String getPayments() { return "Payments "; } | |
@Override | |
public ModuleEnum getModule() { return ModuleEnum.MODULE_PAYMENTS; } |
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
@RestController | |
@RequestMapping("/api/v1/people") | |
public class PeopleController implements ModuleSecurity { | |
@GetMapping | |
public String getPeople() { return "People "; } | |
@Override | |
public ModuleEnum getModule() { return ModuleEnum.MODULE_PEOPLE; } |
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
public interface ModuleSecurity { | |
ModuleEnum getModule(); | |
} |
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
public enum ModuleEnum { | |
MODULE_PEOPLE, | |
MODULE_PAYMENTS, | |
} |