# OAuth2 Custom Field Token Detector
# Detects tokens in non-standard field names
# Example: {"auth_token": "...", "session": "...", "api_key": "..."}
#
# This detector can be customized for proprietary OAuth2 implementations
# that use non-standard field names for tokens
#
# Created: December 2024
# Author: Web Performance Inc

# Detector type: Sticky Regular Expression Assignment Detector

# Descriptive name
detector.name=OAuth2 Custom Token Field (JSON)

# Pattern to match various custom token field names
# Modify this pattern to match your specific API's field names
# Current pattern matches: auth_token, authToken, api_key, apiKey, session_token, sessionToken
search.pattern="(?:auth_token|authToken|api_key|apiKey|session_token|sessionToken)"\\s*:\\s*"([^"]+)"

# JSON content only
content_type.pattern=(?i).*json.*|.*javascript.*|.*html.*

# Single capture group
groups.count=1

# Make it sticky
group1.sticky=true

# Custom equivalency family
# Change this to match your use case
equivalency.name.family=OAuth2-Custom

# JSON unescaping
unescape.source=Only Javascript

# Enable detector
detector=sread

# Platform detection metadata
platform=oauth2
detection.hint=JSON with "access_token", "refresh_token", "token_type", or "Bearer" authorization
