Function bodies 163 total
onboardTenant method · java · L145-L158 (14 LOC)src/main/java/com/dnxt/globaladmin/controller/TenantController.java
public ResponseEntity<ApiResponse> onboardTenant(@Valid @RequestBody TenantOnboardRequest request,
Authentication auth,
HttpServletRequest httpRequest) {
try {
Map<String, Object> result = tenantService.onboardTenant(request, auth.getName());
PlatformTenant tenant = (PlatformTenant) result.get("tenant");
auditService.log(auth.getName(), null, "TENANT_ONBOARDED",
"TENANT", tenant.getTenantId(), tenant.getTenantName(),
"Modules: " + request.getEnabledModules(), httpRequest);
return ResponseEntity.ok(ApiResponse.ok(result));
} catch (IllegalArgumentException e) {
return ResponseEntity.badRequest().body(ApiResponse.error(e.getMessage()));
}
}initiateSupportAccess method · java · L166-L218 (53 LOC)src/main/java/com/dnxt/globaladmin/controller/TenantController.java
public ResponseEntity<ApiResponse> initiateSupportAccess(
@PathVariable String tenantId,
Authentication auth,
HttpServletRequest httpRequest) {
try {
// Validate tenant exists and is active
PlatformTenant tenant = tenantService.getTenant(tenantId);
if (!Boolean.TRUE.equals(tenant.getIsActive())) {
return ResponseEntity.badRequest().body(ApiResponse.error("Tenant is not active"));
}
// Check Operations module is enabled
List<TenantModule> modules = tenantService.getTenantModules(tenantId);
boolean opsEnabled = modules.stream()
.anyMatch(m -> "Operations".equals(m.getModuleName()) && Boolean.TRUE.equals(m.getIsEnabled()));
if (!opsEnabled) {
return ResponseEntity.badRequest().body(ApiResponse.error("Operations module is not enabled for this tenant"));
}
// Check if tenaUserController class · java · L18-L106 (89 LOC)src/main/java/com/dnxt/globaladmin/controller/UserController.java
public class UserController {
@Autowired
private UserManagementService userService;
@Autowired
private AuditService auditService;
@GetMapping
@PermissionCheck("USER_VIEW")
public ResponseEntity<ApiResponse> getAllUsers() {
return ResponseEntity.ok(ApiResponse.ok(userService.getAllUsers()));
}
@GetMapping("/{userId}")
@PermissionCheck("USER_VIEW")
public ResponseEntity<ApiResponse> getUser(@PathVariable String userId) {
try {
return ResponseEntity.ok(ApiResponse.ok(userService.getUser(userId)));
} catch (IllegalArgumentException e) {
return ResponseEntity.status(404).body(ApiResponse.error(e.getMessage()));
}
}
@PostMapping
@PermissionCheck("USER_CREATE")
public ResponseEntity<ApiResponse> createUser(@Valid @RequestBody UserCreateRequest request,
Authentication auth,
getAllUsers method · java · L28-L30 (3 LOC)src/main/java/com/dnxt/globaladmin/controller/UserController.java
public ResponseEntity<ApiResponse> getAllUsers() {
return ResponseEntity.ok(ApiResponse.ok(userService.getAllUsers()));
}getUser method · java · L34-L40 (7 LOC)src/main/java/com/dnxt/globaladmin/controller/UserController.java
public ResponseEntity<ApiResponse> getUser(@PathVariable String userId) {
try {
return ResponseEntity.ok(ApiResponse.ok(userService.getUser(userId)));
} catch (IllegalArgumentException e) {
return ResponseEntity.status(404).body(ApiResponse.error(e.getMessage()));
}
}createUser method · java · L44-L58 (15 LOC)src/main/java/com/dnxt/globaladmin/controller/UserController.java
public ResponseEntity<ApiResponse> createUser(@Valid @RequestBody UserCreateRequest request,
Authentication auth,
HttpServletRequest httpRequest) {
try {
AdminUser user = userService.createUser(request, auth.getName());
auditService.log(auth.getName(), null, "USER_CREATED",
"USER", user.getUserId(), user.getEmail(),
"Role: " + user.getRoleId(), httpRequest);
return ResponseEntity.ok(ApiResponse.ok(user));
} catch (SecurityException e) {
return ResponseEntity.status(403).body(ApiResponse.error(e.getMessage()));
} catch (IllegalArgumentException e) {
return ResponseEntity.badRequest().body(ApiResponse.error(e.getMessage()));
}
}updateUser method · java · L62-L74 (13 LOC)src/main/java/com/dnxt/globaladmin/controller/UserController.java
public ResponseEntity<ApiResponse> updateUser(@PathVariable String userId,
@Valid @RequestBody UserCreateRequest request,
Authentication auth,
HttpServletRequest httpRequest) {
try {
AdminUser user = userService.updateUser(userId, request, auth.getName());
auditService.log(auth.getName(), null, "USER_UPDATED",
"USER", userId, user.getEmail(), null, httpRequest);
return ResponseEntity.ok(ApiResponse.ok(user));
} catch (IllegalArgumentException e) {
return ResponseEntity.badRequest().body(ApiResponse.error(e.getMessage()));
}
}Repobility (the analyzer behind this table) · https://repobility.com
deactivateUser method · java · L78-L90 (13 LOC)src/main/java/com/dnxt/globaladmin/controller/UserController.java
public ResponseEntity<ApiResponse> deactivateUser(@PathVariable String userId,
Authentication auth,
HttpServletRequest httpRequest) {
try {
AdminUser user = userService.getUser(userId);
userService.deactivateUser(userId, auth.getName());
auditService.log(auth.getName(), null, "USER_DEACTIVATED",
"USER", userId, user.getEmail(), null, httpRequest);
return ResponseEntity.ok(ApiResponse.ok("User deactivated"));
} catch (IllegalArgumentException e) {
return ResponseEntity.badRequest().body(ApiResponse.error(e.getMessage()));
}
}resetPassword method · java · L94-L105 (12 LOC)src/main/java/com/dnxt/globaladmin/controller/UserController.java
public ResponseEntity<ApiResponse> resetPassword(@PathVariable String userId,
Authentication auth,
HttpServletRequest httpRequest) {
try {
userService.resetPassword(userId, auth.getName());
auditService.log(auth.getName(), null, "PASSWORD_RESET",
"USER", userId, null, "Admin-initiated reset", httpRequest);
return ResponseEntity.ok(ApiResponse.ok("Password reset. User will receive new credentials."));
} catch (IllegalArgumentException e) {
return ResponseEntity.badRequest().body(ApiResponse.error(e.getMessage()));
}
}ChangePasswordRequest class · java · L7-L19 (13 LOC)src/main/java/com/dnxt/globaladmin/dto/ChangePasswordRequest.java
public class ChangePasswordRequest {
@NotBlank
private String currentPassword;
@NotBlank
@Size(min = 12, message = "Password must be at least 12 characters")
@Pattern(
regexp = "^(?=.*[a-z])(?=.*[A-Z])(?=.*\\d)(?=.*[@$!%*?&#^()\\-_=+])[A-Za-z\\d@$!%*?&#^()\\-_=+]{12,}$",
message = "Password must contain uppercase, lowercase, number, and special character"
)
private String newPassword;
}LoginRequest class · java · L7-L14 (8 LOC)src/main/java/com/dnxt/globaladmin/dto/LoginRequest.java
public class LoginRequest {
@NotBlank(message = "Email is required")
private String email;
@NotBlank(message = "Password is required")
private String password;
}LoginResponse class · java · L7-L18 (12 LOC)src/main/java/com/dnxt/globaladmin/dto/LoginResponse.java
public class LoginResponse {
private String token;
private String userId;
private String username;
private String email;
private String firstName;
private String lastName;
private String role;
private List<String> permissions;
private boolean mustChangePassword;
}TenantCreateRequest class · java · L7-L37 (31 LOC)src/main/java/com/dnxt/globaladmin/dto/TenantCreateRequest.java
public class TenantCreateRequest {
@NotBlank(message = "Tenant name is required")
@Size(max = 200)
private String tenantName;
private String domain;
@Size(max = 100)
private String industry;
@NotBlank(message = "Primary contact name is required")
private String primaryContactName;
@NotBlank(message = "Primary contact email is required")
@Email(message = "Invalid email format")
private String primaryContactEmail;
private String phone;
private String address;
@Size(max = 50)
private String licenseType;
private String licenseExpiry;
@Min(1)
private Integer maxUsers;
private String notes;
}TenantOnboardRequest class · java · L8-L50 (43 LOC)src/main/java/com/dnxt/globaladmin/dto/TenantOnboardRequest.java
public class TenantOnboardRequest {
@NotBlank(message = "Tenant name is required")
private String tenantName;
private String domain;
private String industry;
private String customerType;
@NotBlank(message = "Primary contact name is required")
private String primaryContactName;
@NotBlank(message = "Primary contact email is required")
@Email
private String primaryContactEmail;
private String phone;
private String address;
private String licenseType;
private String licenseExpiry;
@Min(1)
private Integer maxUsers;
private String notes;
// Legacy field — kept for backward compatibility
private List<String> enabledModules;
// Enhanced per-module license configuration
private List<ModuleLicenseConfig> modules;
@Getter @Setter @NoArgsConstructor @AllArgsConstructor
public static class ModuleLicenseConfig {
private String moduleName;
private boolean enabled;
private StriModuleLicenseConfig class · java · L41-L49 (9 LOC)src/main/java/com/dnxt/globaladmin/dto/TenantOnboardRequest.java
public static class ModuleLicenseConfig {
private String moduleName;
private boolean enabled;
private String planId; // FK to module_plan (e.g., "plan-ops-starter")
private String licenseType; // "Concurrent" or "Named"
private String expiryDate; // ISO date (yyyy-MM-dd)
private Integer expiryDaysLeft;
private Integer licensePermits; // max concurrent users
}Repobility · open methodology · https://repobility.com/research/
UserCreateRequest class · java · L7-L21 (15 LOC)src/main/java/com/dnxt/globaladmin/dto/UserCreateRequest.java
public class UserCreateRequest {
@NotBlank(message = "Email is required")
@Email(message = "Invalid email format")
private String email;
@NotBlank(message = "First name is required")
private String firstName;
@NotBlank(message = "Last name is required")
private String lastName;
@NotBlank(message = "Role is required")
private String roleId;
}AdminPermission class · java · L10-L30 (21 LOC)src/main/java/com/dnxt/globaladmin/entity/AdminPermission.java
public class AdminPermission {
@Id
@Column(name = "permission_id")
private String permissionId;
@Column(name = "code", unique = true, nullable = false)
private String code;
@Column(name = "module", nullable = false)
private String module;
@Column(name = "action", nullable = false)
private String action;
@Column(name = "description")
private String description;
@Column(name = "created_date")
private Timestamp createdDate;
}AdminRole class · java · L10-L33 (24 LOC)src/main/java/com/dnxt/globaladmin/entity/AdminRole.java
public class AdminRole {
@Id
@Column(name = "role_id")
private String roleId;
@Column(name = "role_name", unique = true, nullable = false)
private String roleName;
@Column(name = "role_label", nullable = false)
private String roleLabel;
@Column(name = "description")
private String description;
@Column(name = "is_system")
private Boolean isSystem;
@Column(name = "created_date")
private Timestamp createdDate;
@Column(name = "modified_date")
private Timestamp modifiedDate;
}AdminUser class · java · L10-L73 (64 LOC)src/main/java/com/dnxt/globaladmin/entity/AdminUser.java
public class AdminUser {
@Id
@Column(name = "user_id")
private String userId;
@Column(name = "username", unique = true, nullable = false)
private String username;
@Column(name = "email", unique = true, nullable = false)
private String email;
@Column(name = "password_hash")
private String passwordHash;
@Column(name = "first_name")
private String firstName;
@Column(name = "last_name")
private String lastName;
@Column(name = "role_id")
private String roleId;
@ManyToOne(fetch = FetchType.EAGER)
@JoinColumn(name = "role_id", insertable = false, updatable = false)
private AdminRole role;
@Column(name = "is_active")
private Boolean isActive;
@Column(name = "must_change_password")
private Boolean mustChangePassword;
@Column(name = "last_login")
private Timestamp lastLogin;
@Column(name = "failed_attempts")
private Integer failedAttempts;
@Column(name = "locked_until")
prAuditLog class · java · L10-L45 (36 LOC)src/main/java/com/dnxt/globaladmin/entity/AuditLog.java
public class AuditLog {
@Id
@Column(name = "log_id")
private String logId;
@Column(name = "user_id")
private String userId;
@Column(name = "username")
private String username;
@Column(name = "action", nullable = false)
private String action;
@Column(name = "target_type")
private String targetType;
@Column(name = "target_id")
private String targetId;
@Column(name = "target_name")
private String targetName;
@Column(name = "details")
private String details;
@Column(name = "ip_address")
private String ipAddress;
@Column(name = "user_agent")
private String userAgent;
@Column(name = "created_date")
private Timestamp createdDate;
}ModulePlan class · java · L10-L39 (30 LOC)src/main/java/com/dnxt/globaladmin/entity/ModulePlan.java
public class ModulePlan {
@Id
@Column(name = "plan_id")
private String planId;
@Column(name = "module_name", nullable = false)
private String moduleName;
@Column(name = "plan_name", nullable = false)
private String planName;
@Column(name = "plan_label", nullable = false)
private String planLabel;
@Column(name = "description")
private String description;
@Column(name = "features", nullable = false)
private String features;
@Column(name = "sort_order")
private Integer sortOrder;
@Column(name = "is_active")
private Boolean isActive;
@Column(name = "created_date")
private Timestamp createdDate;
}PlatformConfig class · java · L10-L33 (24 LOC)src/main/java/com/dnxt/globaladmin/entity/PlatformConfig.java
public class PlatformConfig {
@Id
@Column(name = "config_key")
private String configKey;
@Column(name = "config_value")
private String configValue;
@Column(name = "category")
private String category;
@Column(name = "description")
private String description;
@Column(name = "is_secret")
private Boolean isSecret;
@Column(name = "modified_by")
private String modifiedBy;
@Column(name = "modified_date")
private Timestamp modifiedDate;
}PlatformTenant class · java · L11-L73 (63 LOC)src/main/java/com/dnxt/globaladmin/entity/PlatformTenant.java
public class PlatformTenant {
@Id
@Column(name = "tenant_id")
private String tenantId;
@Column(name = "tenant_name", nullable = false)
private String tenantName;
@Column(name = "tenant_slug", unique = true, nullable = false)
private String tenantSlug;
@Column(name = "domain")
private String domain;
@Column(name = "industry")
private String industry;
@Column(name = "logo_url")
private String logoUrl;
@Column(name = "primary_contact_name")
private String primaryContactName;
@Column(name = "primary_contact_email")
private String primaryContactEmail;
@Column(name = "phone")
private String phone;
@Column(name = "address")
private String address;
@Column(name = "status")
private String status;
@Column(name = "license_type")
private String licenseType;
@Column(name = "license_expiry")
private Date licenseExpiry;
@Column(name = "max_users")
private Integer maxUsers;If a scraper extracted this row, it came from Repobility (https://repobility.com)
TenantModule class · java · L11-L66 (56 LOC)src/main/java/com/dnxt/globaladmin/entity/TenantModule.java
public class TenantModule {
@Id
@Column(name = "module_id")
private String moduleId;
@Column(name = "tenant_id", nullable = false)
private String tenantId;
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "tenant_id", insertable = false, updatable = false)
private PlatformTenant tenant;
@Column(name = "module_name", nullable = false)
private String moduleName;
@Column(name = "is_enabled")
private Boolean isEnabled;
@Column(name = "licensed_users")
private Integer licensedUsers;
@Column(name = "activated_date")
private Date activatedDate;
@Column(name = "expiry_date")
private Date expiryDate;
@Column(name = "license_type")
private String licenseType;
@Column(name = "plan_id")
private String planId;
@ManyToOne(fetch = FetchType.EAGER)
@JoinColumn(name = "plan_id", insertable = false, updatable = false)
private ModulePlan plan;
@Column(name = "feature_overrides")
prGlobalAdminApplication class · java · L7-L12 (6 LOC)src/main/java/com/dnxt/globaladmin/GlobalAdminApplication.java
public class GlobalAdminApplication {
public static void main(String[] args) {
SpringApplication.run(GlobalAdminApplication.class, args);
}
}main method · java · L9-L11 (3 LOC)src/main/java/com/dnxt/globaladmin/GlobalAdminApplication.java
public static void main(String[] args) {
SpringApplication.run(GlobalAdminApplication.class, args);
}ApiResponse class · java · L5-L34 (30 LOC)src/main/java/com/dnxt/globaladmin/model/ApiResponse.java
public class ApiResponse {
private String status;
private Object data;
private String message;
private ApiResponse() {}
public static ApiResponse ok(Object data) {
ApiResponse r = new ApiResponse();
r.status = "ok";
r.data = data;
return r;
}
public static ApiResponse error(String message) {
ApiResponse r = new ApiResponse();
r.status = "error";
r.message = message;
return r;
}
public static ApiResponse ok() {
return ok(Map.of());
}
public String getStatus() { return status; }
public Object getData() { return data; }
public String getMessage() { return message; }
}ok method · java · L13-L18 (6 LOC)src/main/java/com/dnxt/globaladmin/model/ApiResponse.java
public static ApiResponse ok(Object data) {
ApiResponse r = new ApiResponse();
r.status = "ok";
r.data = data;
return r;
}error method · java · L20-L25 (6 LOC)src/main/java/com/dnxt/globaladmin/model/ApiResponse.java
public static ApiResponse error(String message) {
ApiResponse r = new ApiResponse();
r.status = "error";
r.message = message;
return r;
}ok method · java · L27-L29 (3 LOC)src/main/java/com/dnxt/globaladmin/model/ApiResponse.java
public static ApiResponse ok() {
return ok(Map.of());
}JwtAuthFilter class · java · L27-L111 (85 LOC)src/main/java/com/dnxt/globaladmin/security/JwtAuthFilter.java
public class JwtAuthFilter extends OncePerRequestFilter {
private static final Logger log = LoggerFactory.getLogger(JwtAuthFilter.class);
@Autowired
private JwtTokenProvider tokenProvider;
@Autowired
private AdminUserRepository userRepository;
@Autowired
private AdminPermissionRepository permissionRepository;
@Override
protected void doFilterInternal(HttpServletRequest request,
HttpServletResponse response,
FilterChain chain) throws ServletException, IOException {
try {
String token = extractToken(request);
if (token != null && tokenProvider.validateToken(token)) {
String userId = tokenProvider.getUserIdFromToken(token);
Optional<AdminUser> userOpt = userRepository.findById(userId);
if (userOpt.isPresent()) {
AdminUser user = userOpt.get();
if (Boolean.TWant this analysis on your repo? https://repobility.com/scan/
doFilterInternal method · java · L41-L85 (45 LOC)src/main/java/com/dnxt/globaladmin/security/JwtAuthFilter.java
protected void doFilterInternal(HttpServletRequest request,
HttpServletResponse response,
FilterChain chain) throws ServletException, IOException {
try {
String token = extractToken(request);
if (token != null && tokenProvider.validateToken(token)) {
String userId = tokenProvider.getUserIdFromToken(token);
Optional<AdminUser> userOpt = userRepository.findById(userId);
if (userOpt.isPresent()) {
AdminUser user = userOpt.get();
if (Boolean.TRUE.equals(user.getIsActive())) {
// Check if account is locked
if (user.getLockedUntil() != null &&
user.getLockedUntil().getTime() > System.currentTimeMillis()) {
log.warn("JWT valid but account is locked: {}", userId);
chaishouldNotFilter method · java · L88-L102 (15 LOC)src/main/java/com/dnxt/globaladmin/security/JwtAuthFilter.java
protected boolean shouldNotFilter(HttpServletRequest request) {
String path = request.getServletPath();
if (!path.startsWith("/api/")) {
return true;
}
if (path.equals("/api/auth/login") || path.startsWith("/api/auth/google/")) {
return true;
}
if (path.startsWith("/actuator")) {
return true;
}
return false;
}extractToken method · java · L104-L110 (7 LOC)src/main/java/com/dnxt/globaladmin/security/JwtAuthFilter.java
private String extractToken(HttpServletRequest request) {
String header = request.getHeader("Authorization");
if (header != null && header.startsWith("Bearer ")) {
return header.substring(7);
}
return null;
}JwtTokenProvider class · java · L16-L82 (67 LOC)src/main/java/com/dnxt/globaladmin/security/JwtTokenProvider.java
public class JwtTokenProvider {
private static final Logger log = LoggerFactory.getLogger(JwtTokenProvider.class);
@Value("${admin.jwt.secret}")
private String jwtSecret;
@Value("${admin.jwt.expiration-ms}")
private long jwtExpirationMs;
public String generateToken(String userId, String email) {
Date now = new Date();
Date expiry = new Date(now.getTime() + jwtExpirationMs);
return Jwts.builder()
.subject(userId)
.claim("email", email)
.issuedAt(now)
.expiration(expiry)
.signWith(getSigningKey())
.compact();
}
public String getUserIdFromToken(String token) {
Claims claims = Jwts.parser()
.verifyWith(getSigningKey())
.build()
.parseSignedClaims(token)
.getPayload();
return claims.getSubject();
}
public String getEmailFromToken(String token) {
generateToken method · java · L26-L37 (12 LOC)src/main/java/com/dnxt/globaladmin/security/JwtTokenProvider.java
public String generateToken(String userId, String email) {
Date now = new Date();
Date expiry = new Date(now.getTime() + jwtExpirationMs);
return Jwts.builder()
.subject(userId)
.claim("email", email)
.issuedAt(now)
.expiration(expiry)
.signWith(getSigningKey())
.compact();
}getUserIdFromToken method · java · L39-L46 (8 LOC)src/main/java/com/dnxt/globaladmin/security/JwtTokenProvider.java
public String getUserIdFromToken(String token) {
Claims claims = Jwts.parser()
.verifyWith(getSigningKey())
.build()
.parseSignedClaims(token)
.getPayload();
return claims.getSubject();
}getEmailFromToken method · java · L48-L55 (8 LOC)src/main/java/com/dnxt/globaladmin/security/JwtTokenProvider.java
public String getEmailFromToken(String token) {
Claims claims = Jwts.parser()
.verifyWith(getSigningKey())
.build()
.parseSignedClaims(token)
.getPayload();
return claims.get("email", String.class);
}validateToken method · java · L57-L76 (20 LOC)src/main/java/com/dnxt/globaladmin/security/JwtTokenProvider.java
public boolean validateToken(String token) {
try {
Jwts.parser()
.verifyWith(getSigningKey())
.build()
.parseSignedClaims(token);
return true;
} catch (ExpiredJwtException e) {
log.warn("JWT token expired: {}", e.getMessage());
} catch (MalformedJwtException e) {
log.warn("Malformed JWT token: {}", e.getMessage());
} catch (SignatureException e) {
log.warn("Invalid JWT signature: {}", e.getMessage());
} catch (UnsupportedJwtException e) {
log.warn("Unsupported JWT token: {}", e.getMessage());
} catch (IllegalArgumentException e) {
log.warn("JWT claims string is empty or null: {}", e.getMessage());
}
return false;
}Repobility (the analyzer behind this table) · https://repobility.com
getSigningKey method · java · L78-L81 (4 LOC)src/main/java/com/dnxt/globaladmin/security/JwtTokenProvider.java
private SecretKey getSigningKey() {
byte[] keyBytes = jwtSecret.getBytes(StandardCharsets.UTF_8);
return Keys.hmacShaKeyFor(keyBytes);
}LoginRateLimiter class · java · L17-L64 (48 LOC)src/main/java/com/dnxt/globaladmin/security/LoginRateLimiter.java
public class LoginRateLimiter {
private static final Logger log = LoggerFactory.getLogger(LoginRateLimiter.class);
@Value("${admin.security.login-rate-limit-per-ip:10}")
private int maxAttemptsPerWindow;
@Value("${admin.security.login-rate-limit-window-minutes:15}")
private int windowMinutes;
private final Map<String, WindowEntry> attempts = new ConcurrentHashMap<>();
public boolean isRateLimited(String ipAddress) {
long now = System.currentTimeMillis();
long windowMs = windowMinutes * 60_000L;
WindowEntry entry = attempts.compute(ipAddress, (key, existing) -> {
if (existing == null || (now - existing.windowStart) > windowMs) {
return new WindowEntry(now, new AtomicInteger(1));
}
existing.count.incrementAndGet();
return existing;
});
boolean limited = entry.count.get() > maxAttemptsPerWindow;
if (limited) {
log.warn("Rate limit eisRateLimited method · java · L29-L47 (19 LOC)src/main/java/com/dnxt/globaladmin/security/LoginRateLimiter.java
public boolean isRateLimited(String ipAddress) {
long now = System.currentTimeMillis();
long windowMs = windowMinutes * 60_000L;
WindowEntry entry = attempts.compute(ipAddress, (key, existing) -> {
if (existing == null || (now - existing.windowStart) > windowMs) {
return new WindowEntry(now, new AtomicInteger(1));
}
existing.count.incrementAndGet();
return existing;
});
boolean limited = entry.count.get() > maxAttemptsPerWindow;
if (limited) {
log.warn("Rate limit exceeded for IP: {} ({} attempts in {} min window)",
ipAddress, entry.count.get(), windowMinutes);
}
return limited;
}cleanup method · java · L49-L53 (5 LOC)src/main/java/com/dnxt/globaladmin/security/LoginRateLimiter.java
public void cleanup() {
long now = System.currentTimeMillis();
long windowMs = windowMinutes * 60_000L;
attempts.entrySet().removeIf(e -> (now - e.getValue().windowStart) > windowMs);
}WindowEntry class · java · L55-L63 (9 LOC)src/main/java/com/dnxt/globaladmin/security/LoginRateLimiter.java
private static class WindowEntry {
final long windowStart;
final AtomicInteger count;
WindowEntry(long windowStart, AtomicInteger count) {
this.windowStart = windowStart;
this.count = count;
}
}WindowEntry method · java · L59-L62 (4 LOC)src/main/java/com/dnxt/globaladmin/security/LoginRateLimiter.java
WindowEntry(long windowStart, AtomicInteger count) {
this.windowStart = windowStart;
this.count = count;
}PermissionAspect class · java · L13-L34 (22 LOC)src/main/java/com/dnxt/globaladmin/security/PermissionAspect.java
public class PermissionAspect {
@Around("@annotation(permissionCheck)")
public Object checkPermission(ProceedingJoinPoint joinPoint, PermissionCheck permissionCheck) throws Throwable {
String requiredPermission = permissionCheck.value();
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
if (authentication == null || !authentication.isAuthenticated()) {
throw new SecurityException("Not authenticated");
}
boolean hasPermission = authentication.getAuthorities().stream()
.map(GrantedAuthority::getAuthority)
.anyMatch(a -> a.equals(requiredPermission));
if (!hasPermission) {
throw new SecurityException("Insufficient permissions: " + requiredPermission);
}
return joinPoint.proceed();
}
}checkPermission method · java · L16-L33 (18 LOC)src/main/java/com/dnxt/globaladmin/security/PermissionAspect.java
public Object checkPermission(ProceedingJoinPoint joinPoint, PermissionCheck permissionCheck) throws Throwable {
String requiredPermission = permissionCheck.value();
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
if (authentication == null || !authentication.isAuthenticated()) {
throw new SecurityException("Not authenticated");
}
boolean hasPermission = authentication.getAuthorities().stream()
.map(GrantedAuthority::getAuthority)
.anyMatch(a -> a.equals(requiredPermission));
if (!hasPermission) {
throw new SecurityException("Insufficient permissions: " + requiredPermission);
}
return joinPoint.proceed();
}Repobility · open methodology · https://repobility.com/research/
AuditService class · java · L17-L68 (52 LOC)src/main/java/com/dnxt/globaladmin/service/AuditService.java
public class AuditService {
private static final Logger log = LoggerFactory.getLogger(AuditService.class);
@Autowired
private AuditLogRepository auditLogRepository;
public void log(String userId, String username, String action,
String targetType, String targetId, String targetName,
String details, HttpServletRequest request) {
AuditLog entry = new AuditLog();
entry.setLogId(UUID.randomUUID().toString());
entry.setUserId(userId);
entry.setUsername(username);
entry.setAction(action);
entry.setTargetType(targetType);
entry.setTargetId(targetId);
entry.setTargetName(targetName);
entry.setDetails(details);
entry.setIpAddress(getClientIp(request));
entry.setUserAgent(request != null ? request.getHeader("User-Agent") : null);
entry.setCreatedDate(new Timestamp(System.currentTimeMillis()));
auditLogRepository.save(entry);
lolog method · java · L24-L42 (19 LOC)src/main/java/com/dnxt/globaladmin/service/AuditService.java
public void log(String userId, String username, String action,
String targetType, String targetId, String targetName,
String details, HttpServletRequest request) {
AuditLog entry = new AuditLog();
entry.setLogId(UUID.randomUUID().toString());
entry.setUserId(userId);
entry.setUsername(username);
entry.setAction(action);
entry.setTargetType(targetType);
entry.setTargetId(targetId);
entry.setTargetName(targetName);
entry.setDetails(details);
entry.setIpAddress(getClientIp(request));
entry.setUserAgent(request != null ? request.getHeader("User-Agent") : null);
entry.setCreatedDate(new Timestamp(System.currentTimeMillis()));
auditLogRepository.save(entry);
log.info("AUDIT: {} by {} on {}/{} ({})", action, username, targetType, targetId, details);
}log method · java · L44-L46 (3 LOC)src/main/java/com/dnxt/globaladmin/service/AuditService.java
public void log(String action, String details, HttpServletRequest request) {
log(null, null, action, null, null, null, details, request);
}