VehicleVision.PleasanterTools.SessionLink 0.1.1

Prefix Reserved
dotnet add package VehicleVision.PleasanterTools.SessionLink --version 0.1.1
                    
NuGet\Install-Package VehicleVision.PleasanterTools.SessionLink -Version 0.1.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="VehicleVision.PleasanterTools.SessionLink" Version="0.1.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="VehicleVision.PleasanterTools.SessionLink" Version="0.1.1" />
                    
Directory.Packages.props
<PackageReference Include="VehicleVision.PleasanterTools.SessionLink" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add VehicleVision.PleasanterTools.SessionLink --version 0.1.1
                    
#r "nuget: VehicleVision.PleasanterTools.SessionLink, 0.1.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package VehicleVision.PleasanterTools.SessionLink@0.1.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=VehicleVision.PleasanterTools.SessionLink&version=0.1.1
                    
Install as a Cake Addin
#tool nuget:?package=VehicleVision.PleasanterTools.SessionLink&version=0.1.1
                    
Install as a Cake Tool

プリザンターのログインを、別のアプリでも。

同じホストに配置した .NET アプリから、Pleasanter にログイン済みの利用者を認証 Cookie で確認できます。 API キー必須化は PleasanterSsoOptions.RequireApiKey で切り替えます。既定は無効です。

  • VerifyAsync に受信した Cookie ヘッダーを渡します。信頼済みプロキシで確認した IP があれば併せて渡せます。
  • 有効時の EnsureApiKeyAsync は、キーがない利用者に ConfirmationRequired を返します。 呼び出し側は確認画面を表示し、CSRF を検証した POST で確認時の利用者 ID を渡します。 既存キーが基準を満たせば Ready を返します。
  • PleasanterApiKeyStatusStore に SQL Server、PostgreSQL、MySQL 用の DbConnection を生成する関数を渡します。 DB では Users のテナント、本人、無効・ロックアウト、キーの状態を照合します。 発行は本人の Cookie で Pleasanter に依頼します。

アプリ内では PleasanterSsoClient を共有してください。発行処理は同じクライアント内で直列化します。 アプリを複数のインスタンスで動かす場合は、呼び出し側でも同一利用者の発行処理を直列化してください。

アプリへの自動ログイン

Pleasanter の認証 Cookie がアプリの URL に届く構成で、PleasanterSessionHandoff をアプリの入口から呼び出します。 たとえば Pleasanter とアプリを同じ HTTPS ホストで公開し、Cookie の Path にアプリのパスが含まれる場合です。 アプリにログイン済みか、自動ログインを抑止している場合は、Pleasanter への問い合わせを省きます。

ASP.NET Core で AppCookie スキームを登録済みの場合、入口のハンドラーには次のように組み込めます。

var existing = await context.AuthenticateAsync("AppCookie");
var result = await handoff.TrySignInAsync(
    context.Request.Headers.Cookie.OfType<string>(),
    appIsAuthenticated: existing.Succeeded,
    suppressAutomaticSignIn: context.Request.Cookies.ContainsKey("__Host-MyApp.NoAutoSignIn"),
    authorizeAsync: ResolveAllowedPrincipalAsync,
    signInAsync: (principal, _) => context.SignInAsync("AppCookie", principal),
    cancellationToken: context.RequestAborted);

ResolveAllowedPrincipalAsync は確認済みの SessionResult を受け取り、テナントとユーザー ID をアプリ側の利用者に照合します。 許可された場合は認証済みの ClaimsPrincipal を組み立て、未登録・無効・権限外の場合は null を返します。 SignedIn が返ったらアプリ内の固定パスへリダイレクトし、次のリクエストからアプリの Cookie で認証します。 PleasanterSignInRequired が返ったら、利用者を Pleasanter のログインへ案内できます。

明示ログアウトは CSRF を検証した POST で行います。AppCookie からサインアウトし、 例の抑止 Cookie を Secure、HttpOnly、SameSite=Lax、Path=/、Domain 指定なしでセットします。 利用者がアプリで「Pleasanter でログイン」を再度選んだときに抑止 Cookie を削除します。 入口の応答は Cache-Control: no-store を指定し、Front Door などでキャッシュを無効にしてください。 アプリと Pleasanter のログイン Cookie は別の名前を使います。 アプリに Pleasanter の Cookie が届かないホスト間の遷移には、OAuth/OIDC などの認証連携が必要です。 ASP.NET Core の Cookie 認証(参照日 2026-12-03)。

API キーの強度設定

API キー必須化が有効な場合は、ApiKeyPolicy.MinimumLength(0~128、既定 0)と ApiKeyPolicy.RequirePleasanterFormat(既定 false)を指定できます。 本体形式は128桁の16進文字です。DB から返すのは照合結果のみです。 基準未達のキーは InsufficientStrength を返し、既存キーを上書きしません。 文字数と形式の照合で、キーの乱数品質は判定できません。Pleasanter のキー生成処理(参照日 2026-12-03)

ライセンス

提供条件は DotNetClient と同じ 3 層です。ライセンス案内

層 提供条件
A LGPL-3.0-or-later。個人・非営利団体・教育機関が営利事業に使わない場合
B AGPL-3.0-or-later。営利事業や公的機関での利用で AGPL の条件に従う場合
C 商用ライセンス。個別契約で利用する場合

貢献のしかた · 開発文書

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net10.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.1.1 52 12/2/2026
0.1.0 53 12/2/2026