PHPackages                             nawasara/auth-primitives - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. nawasara/auth-primitives

ActiveLibrary[Authentication &amp; Authorization](/categories/authentication)

nawasara/auth-primitives
========================

Low-level auth primitives for Nawasara packages: sudo mode (session window, Livewire attribute, route middleware), built to live below the application shell so domain packages can depend on it without dragging in core.

v0.1.0(2mo ago)0975MITPHPPHP ^8.1

Since May 25Pushed 2mo agoCompare

[ Source](https://github.com/nawasara/auth-primitives)[ Packagist](https://packagist.org/packages/nawasara/auth-primitives)[ RSS](/packages/nawasara-auth-primitives/feed)WikiDiscussions main Synced 1w ago

READMEChangelogDependencies (2)Versions (2)Used By (5)

nawasara/auth-primitives
========================

[](#nawasaraauth-primitives)

Low-level auth primitives for [Nawasara](https://github.com/nawasara)packages. Lives below the application shell (`nawasara/core`) so any domain package can depend on it without pulling in the rest of Nawasara.

What's in the box
-----------------

[](#whats-in-the-box)

PrimitivePurpose`Nawasara\AuthPrimitives\Auth\Sudo`Session window — single source of truth for "has the user recently re-authenticated?"`Nawasara\AuthPrimitives\Http\Middleware\EnsureSudo`Route gate, registered as the `sudo` middleware alias`#[Nawasara\AuthPrimitives\Attributes\RequiresSudo]`Livewire method attribute — gates one action behind sudo`Nawasara\AuthPrimitives\Traits\WithSudo`Livewire component trait — handles the step-up redirect`Nawasara\AuthPrimitives\Exceptions\SudoRequiredException`Renderable exception (403 or redirect)`sudo_active()`, `sudo_remaining_seconds()`Blade helpersWhat's NOT in here
------------------

[](#whats-not-in-here)

The OTP step-up itself (IdP redirect, callback, ID-token verification) is **not** in this package. It lives in `nawasara/core`'s `SudoController`, which calls `Sudo::confirm($userId)` on a verified step-up. This split lets domain packages enforce a sudo window without depending on the integration plumbing.

Usage
-----

[](#usage)

### Route-level

[](#route-level)

```
Route::get('db/drop/{name}', ...)->middleware(['auth', 'sudo']);
```

The `sudo` alias is registered automatically by `AuthPrimitivesServiceProvider`.

### Livewire action-level

[](#livewire-action-level)

```
use Livewire\Component;
use Nawasara\AuthPrimitives\Attributes\RequiresSudo;
use Nawasara\AuthPrimitives\Traits\WithSudo;

class DangerousThings extends Component
{
    use WithSudo;

    #[RequiresSudo(reason: 'menghapus database')]
    public function dropDatabase(string $name): void
    {
        // …only runs inside an active sudo window
    }
}
```

### Blade display

[](#blade-display)

```
@if (sudo_active())
    Hapus
@else
    Hapus (butuh konfirmasi)
@endif
```

Config
------

[](#config)

Defaults are bundled. Publish to override:

```
php artisan vendor:publish --tag=auth-primitives:config
```

```
// config/auth-primitives.php
return [
    'sudo' => [
        'window_minutes' => env('NAWASARA_SUDO_WINDOW_MINUTES', 15),
        'acr' => env('NAWASARA_SUDO_ACR', 'sudo'),
    ],
];
```

License
-------

[](#license)

MIT.

###  Health Score

38

—

LowBetter than 83% of packages

Maintenance88

Actively maintained with recent releases

Popularity14

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity32

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

60d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/16914951?v=4)[Pringgo J. Saputro](/maintainers/pringgojs)[@pringgojs](https://github.com/pringgojs)

![](https://www.gravatar.com/avatar/edcf770bde3babcc9fa554e305e361b8614c1e505470e75842de75ea3e502548?d=identicon)[nawasara](/maintainers/nawasara)

---

Top Contributors

[![pringgojs](https://avatars.githubusercontent.com/u/16914951?v=4)](https://github.com/pringgojs "pringgojs (1 commits)")

---

Tags

laravelauthlivewiresudoNawasarastep-up

### Embed Badge

![Health badge](/badges/nawasara-auth-primitives/health.svg)

```
[![Health](https://phpackages.com/badges/nawasara-auth-primitives/health.svg)](https://phpackages.com/packages/nawasara-auth-primitives)
```

###  Alternatives

[livewire/flux

The official UI component library for Livewire.

9577.8M138](/packages/livewire-flux)[tallstackui/tallstackui

TallStackUI is a powerful suite of Blade components that elevate your workflow of Livewire applications.

728176.2k14](/packages/tallstackui-tallstackui)[tomshaw/electricgrid

A feature-rich Livewire package designed for projects that require dynamic, interactive data tables.

119.4k](/packages/tomshaw-electricgrid)[mati365/ckeditor5-livewire

CKEditor 5 integration for Laravel Livewire

447.9k](/packages/mati365-ckeditor5-livewire)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
