定制 zestic/graphql-auth-component 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

zestic/graphql-auth-component

最新稳定版本:v0.3.0

Composer 安装命令:

composer require zestic/graphql-auth-component

包简介

无描述信息

README 文档

README

Test Lint codecov PHP Version License

A GraphQL authentication component with OAuth2 support, magic link authentication, and JWT tokens.

Setup

Generating OAuth2 Keys

Before using the authentication component, you need to generate the required OAuth2 keys:

composer run generate-keys

This script will generate:

  • JWT Private/Public Key Pair: Used for signing and verifying JWT tokens
  • Encryption Key: Used for encrypting authorization and refresh codes

The keys will be saved to:

  • config/jwt/private.key - JWT private key (keep secure!)
  • config/jwt/public.key - JWT public key
  • config/autoload/auth.local.php - Contains only the encryption key

Important: The script will fail if keys already exist to prevent accidental overwriting.

Key Generation Parameters

The script uses configurable OpenSSL parameters for JWT key generation:

  • digestAlg: Hash algorithm (sha256, sha384, sha512)

    • sha256: Fast, widely supported (default)
    • sha384: More secure, good balance
    • sha512: Most secure, slower
  • privateKeyBits: Key size in bits (2048, 3072, 4096)

    • 2048: Fast, minimum recommended (default)
    • 3072: Good security/performance balance
    • 4096: Maximum security, slower
  • privateKeyType: Key algorithm (RSA, DSA, DH, EC)

    • RSA: Most widely supported (default)
    • EC: Elliptic Curve, smaller keys, good performance

Docker Support

For Docker environments, you can override the key paths using environment variables:

export JWT_PRIVATE_KEY_PATH=/app/keys/jwt/private.key export JWT_PUBLIC_KEY_PATH=/app/keys/jwt/public.key export AUTH_LOCAL_CONFIG_PATH=/app/config/autoload/auth.local.php composer run generate-keys

Configuration

The component uses the following default configuration structure:

'auth' => [ 'jwt' => [ 'privateKeyPath' => 'config/jwt/private.key', 'publicKeyPath' => 'config/jwt/public.key', 'passphrase' => null, // Set via environment if needed 'keyGeneration' => [ 'digestAlg' => 'sha256', // sha256, sha384, sha512 'privateKeyBits' => 2048, // 2048, 3072, 4096 'privateKeyType' => 'RSA', // RSA, DSA, DH, EC ], ], 'token' => [ 'accessTokenTtl' => 60, // 1 hour (in minutes) 'loginTtl' => 10, // 10 minutes 'refreshTokenTtl' => 10080, // 1 week (in minutes) 'registrationTtl' => 1440, // 24 hours (in minutes) ], ]

Notifications

Need to create a class that implements SendVerificationEmailInterface and configure it

统计信息

  • 总下载量: 1.15k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: Apache-2.0
  • 更新时间: 2026-01-04

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固