SessionBridgeFactory
Builds a {@see SessionBridge} per named instance, so an app with several
session user-types (e.g. staff web + customer customer) federates each to
the auth-server without hand-constructing a bridge in every controller.
Instances are declared under vauth.bridge.instances (keyed by name, which
defaults to the session guard); any key an instance omits falls back to the
base vauth.bridge config. The single-bridge app(SessionBridge::class)
path is unchanged — this is purely additive for the multi-guard case.
$bridge = app(SessionBridgeFactory::class)->for(‘customer’); $user = $bridge->loginWithPassword($email, $password);
Methods
__construct()
function __construct( private readonly Container $container, private readonly array $instances, private readonly array $defaults,)Parameters
$instances—array<string, array<string, mixed>>·vauth.bridge.instances$defaults—array<string, mixed>· basevauth.bridgeconfig
Annotations
@vararray<string, SessionBridge> / private array $cache = []; /*
for()
function for(string $name): SessionBridgeThe bridge for a named instance (cached). Falls back to the base
vauth.bridge config for any unset key; an instance’s guard defaults to
its own name when not given. An unknown name builds against the defaults
under that guard name — handy for guard-name-as-instance setups.
names()
function names(): arrayDeclared instance names (from config).
has()
function has(string $name): boolWhether a named instance is declared in config.
build()
function build(array $cfg): SessionBridgeParameters
$cfg—array<string, mixed>
makeResolver()
function makeResolver(array $cfg): ResolvesShadowUserBuild the resolver for an instance: a bound custom resolver class-string,
else a configured {@see EmailShadowUserResolver}. Mirrors the default
single-bridge resolver binding in the service provider.
Parameters
$cfg—array<string, mixed>