efw Framework Login and Authorization Control Example

Overview

This is a sample web application based on the efw framework, demonstrating comprehensive login control and authorization management functionality. Designed for both internal enterprise systems and internet-facing web applications, it provides a defense-in-depth security architecture that effectively prevents direct URL access and malicious calls through developer tools.

Key Features

Login Control

Authorization Control

Security Architecture: Defense in Depth

Frontend Security Protection

Prevents direct component calls through the <efw:client> tag mechanism:

Protection Principle:

Security Effect:

Direct access: http://app.com/MST01_inputdialog.jsp 
→ Page loads but all functionality is disabled

Proper access: Through main page dialog → Full functionality works

Backend Security Validation

Server-side session and permission checks as the ultimate defense line:

Session Validation:

Permission Checking:

Protection Effect:

// Hacker attempt to forge request in developer tools
fetch('/app/event', {
    method: 'POST', 
    body: 'eventId=MST01_delete&userId=123'
});
 Backend validates user permissions  Insufficient permissions  Returns error page

Project Structure

skeletonSample/
├── JSP Pages/
│   ├── LG01.jsp          # Login page
│   ├── LG02.jsp          # Menu page
│   ├── LG03.jsp          # Password recovery page
│   ├── LG04.jsp          # Password change page
│   ├── MST01.jsp         # User management main page
│   ├── error.jsp         # Error page
│   └── Component files...
├── JavaScript Event Files/
│   ├── LG01_*.js         # Login-related events
│   ├── LG02_*.js         # Menu-related events
│   ├── MST01_*.js        # User management events
│   └── Global events...
├── Configuration Files/
│   └── efw.properties    # Framework configuration
└── Database Files/
    ├── skeletonSample.backup    # PostgreSQL backup
    └── ユーザマスタDDL.sql      # User table creation script

Core Configuration

Login Control (efw.properties)

# Enable login control
efw.login.check = true
efw.login.key = USER_ID
efw.login.url = LG01.jsp

# Login-free page patterns
efw.outoflogin.url.pattern = LG01|LG03|LG04.jsp
efw.outoflogin.eventid.pattern = LG01|LG03|LG04|head_logout

Authorization Control (efw.properties)

# Enable authorization control
efw.auth.check = true
efw.auth.key = USER_ID
efw.system.error.url = error.jsp

# Role definitions
efw.auth.cases = admin,user

# Administrator permissions
admin.auth.pattern = ^admin.*$
admin.url.pattern = LG02|MST01.jsp
admin.eventid.pattern = LG02|MST01

# Regular user permissions
user.auth.pattern = ^((?!admin).)*$
user.url.pattern = LG02.jsp
user.eventid.pattern = LG02

Security Features Explained

1. Frontend Component Protection

2. Backend Session Validation

3. Authorization Flow

User request → Frontend component validation → Backend session validation → Backend permission validation → Business execution

4. Error Handling Strategy

Database Design

User master table structure:

CREATE TABLE "ユーザマスタ" (
    "ユーザID" VARCHAR(10) NOT NULL PRIMARY KEY,    -- User ID
    "パスワード" VARCHAR(10),                      -- Password
    "ユーザ名" VARCHAR(20),                        -- Username
    "メール" VARCHAR(50),                         -- Email
    "コメント" VARCHAR(200),                       -- Comments
    "初期化フラグ" INTEGER,                        -- Initialization flag
    "ロックフラグ" INTEGER,                        -- Lock flag
    "パスワード更新日" DATE,                       -- Password update date
    "作成日時" DATE,                              -- Creation timestamp
    "作成者" VARCHAR(10),                         -- Creator
    "更新日時" DATE,                              -- Update timestamp
    "更新者" VARCHAR(10)                          -- Updater
);

System Requirements

Quick Start

  1. Restore database backup or execute provided SQL script
  2. Configure database connection parameters
  3. Deploy to web server
  4. Access login page to begin using

Security Best Practices

  1. Session management: Set appropriate session timeout periods
  2. Password policies: Implement strong password requirements and regular changes
  3. Error handling: Unified error pages to prevent information leakage
  4. Logging: Record important security events
  5. Regular audits: Review permission configurations and user roles

This example demonstrates a complete security solution for enterprise-level web applications using the efw framework. Through the frontend protection + backend validation defense-in-depth architecture, it provides enterprise-grade security assurance for web applications.