<?php
namespace App\Models\Scopes;
use App\Support\TenantContext;
use Illuminate\Database\Eloquent\Builder;
package com.example.audit.config;
import java.util.Optional;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.domain.AuditorAware;
class Current < ActiveSupport::CurrentAttributes
attribute :tenant, :request_id
def tenant=(tenant)
super
Rails.logger.tagged("tenant=#{tenant&.id}") if tenant
package com.example.security;
import io.jsonwebtoken.Claims;
import io.jsonwebtoken.Jwts;
import io.jsonwebtoken.security.Keys;
import org.springframework.beans.factory.annotation.Value;
import { SetMetadata } from '@nestjs/common';
export enum Role {
User = 'user',
Editor = 'editor',
Admin = 'admin',
class DownloadsController < ApplicationController
before_action :authenticate_user!, only: :create
skip_before_action :verify_authenticity_token, only: :show
def create
document = current_user.documents.find(params[:document_id])
import { Request, Response } from 'express';
import { authenticate } from './auth.service';
export async function login(req: Request, res: Response): Promise<void> {
const { email, password } = req.body ?? {};
const crypto = require('crypto');
function parseSignatureHeader(header) {
const parts = {};
for (const segment of String(header || '').split(',')) {
const [key, value] = segment.split('=');
<?php
namespace App\Providers;
use Illuminate\Cache\RateLimiting\Limit;
use Illuminate\Http\Request;
class LoginCode < ApplicationRecord
belongs_to :user
CODE_LENGTH = 6
TTL = 10.minutes
<?php
namespace App\Models;
use App\Notifications\VerifyEmailNotification;
use Illuminate\Contracts\Auth\MustVerifyEmail;
<?php
namespace App\Security\Voter;
use App\Entity\Comment;
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;