authorization

typescript
import { cookies } from "next/headers";
import { jwtVerify } from "jose";

export interface Session {
  userId: string;
  role: "user" | "admin";

Next.js Route Handler with auth guard

nextjs route-handlers authentication
by codesnips 3 tabs
typescript
import { Injectable, signal, computed } from '@angular/core';

export interface CurrentUser {
  id: string;
  email: string;
  roles: string[];

Guarding a Lazy-Loaded Angular Admin Route with a Functional CanActivate Role Check

angular routing lazy-loading
by codesnips 3 tabs
php
<?php

namespace App\Policies;

use App\Models\Post;
use App\Models\User;

Authorize Post Editing With a Laravel Policy and Gate the Controller

laravel authorization policies
by codesnips 3 tabs
php
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

Soft-Delete and Restore Blog Posts with a Trash View in Laravel

laravel eloquent soft-deletes
by codesnips 4 tabs
java
package com.example.demo.config;

import com.example.demo.security.JwtAuthenticationFilter;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.authentication.AuthenticationManager;

Security with Spring Security and JWT

java spring-security jwt
by David Kumar 3 tabs
php
<?php

namespace App\Policies;

use App\Models\Post;
use App\Models\User;

Laravel policies for authorization

laravel authorization policies
by Carlos Mendez 3 tabs