Prismatic SSO CDN & Backend Middleware Docs
Complete technical specification and copy-paste code snippets for integrating Laravel, Node.js, and .NET Core product backends with Prismatic Central SaaS Engine.
Will calling Central SaaS over HTTP on every request slow down our system?
NO! By using 15-Minute Local Cache Storage (Redis / MemoryCache) or Offline RS256 Verification, 99.9% of HTTP requests hit local memory in 0.1ms. Central SaaS is only called once every 15 minutes per active tenant!
Add this 2-line CSS snippet to your product application's main layout head. If the CDN script is removed or blocked, body remains hidden (`display: none`).
/* Product UI is hidden by default until Prismatic CDN Script verifies active subscription */
body:not(.prismatic-sso-verified) {
display: none !important;
}Paste this single script tag inside the head of your separate product app:
<!-- Prismatic Central SaaS Zero-API Embed Script -->
<script
src="http://localhost:5000/embed.js"
data-product-code="lms"
data-tenant-id="8f3b-4192-938b-71a2b918f001"
data-central-url="http://localhost:5000"
></script>3. Production Backend Middleware (15-Min Redis Caching)
Select your backend framework below for complete copy-paste middleware implementation.
<?php
namespace App\Services;
use Illuminate\Support\Facades\Http;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Cache;
class PrismaticSSO {
public static function verify($token = null, $productCode = "lms") {
if (!$token) {
$token = DB::table("company_settings")->value("sso_token");
}
if (!$token) return false;
$cacheKey = "prismatic_sso_verified_" . md5($token);
return Cache::remember($cacheKey, 900, function () use ($token, $productCode) {
try {
$response = Http::withToken($token)
->timeout(3)
->post("http://localhost:5000/api/v1/auth/verify-token", [
"product_code" => $productCode
]);
if ($response->successful() && $response->json("valid") === true) {
$data = $response->json("data");
DB::table("company_settings")->updateOrInsert(
["tenant_id" => $data["tenant_id"]],
[
"company_name" => $data["company_name"],
"official_email" => $data["email"],
"subscription_status" => $data["subscription_status"],
"sso_token" => $token,
"features" => json_encode($data["features"]),
"updated_at" => now()
]
);
return true;
}
} catch (\Exception $e) {
\Log::error("Prismatic SSO Error: " . $e->getMessage());
}
return false;
});
}
}<?php
namespace App\Http\Middleware;
use Closure;
use App\Services\PrismaticSSO;
class VerifyPrismaticTenant {
public function handle($request, Closure $next) {
$token = $request->bearerToken() ?? $request->query("token");
if (!PrismaticSSO::verify($token, "lms")) {
return response()->json([
"status" => "error",
"error" => "Subscription Lock: Access Denied. Active Prismatic SaaS License Required."
], 403);
}
return $next($request);
}
}