一键导入
servicestack-authentication
Implements authentication using ServiceStack Auth Providers and session handling.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Implements authentication using ServiceStack Auth Providers and session handling.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Designs stable, discoverable APIs using routes, metadata, and versioning conventions.
Applies role-, permission-, and ownership-based authorization using ServiceStack idioms.
Implements AutoQuery services, custom filters, and permission-aware querying.
Designs request/response DTOs using DTO-first, message-based ServiceStack conventions.
Controls OpenAPI / metadata exposure without compromising ServiceStack-first design.
Uses OrmLite via the implicit Db connection and understands transaction semantics and rollback behavior.
| name | servicestack-authentication |
| description | Implements authentication using ServiceStack Auth Providers and session handling. |
ServiceStack provides a robust authentication system that supports multiple providers (Credentials, JWT, OAuth, etc.).
Authentication is enabled by registering the AuthFeature in AppHost.Configure.
Plugins.Add(new AuthFeature(() => new AuthUserSession(),
new IAuthProvider[] {
new CredentialsAuthProvider(), // Enable email/password login
new JwtAuthProvider(AppSettings) { ... } // Enable JWT
}));
A persistence layer (IAuthRepository) is required to store user accounts.
container.Register<IAuthRepository>(c =>
new OrmLiteAuthRepository(c.Resolve<IDbConnectionFactory>()));
Apply the [Authenticate] attribute to Service classes or Request DTOs.
[Authenticate]
public class MySecureRequest : IReturn<MyResponse> { ... }
Inside a Service, use GetSession() or the SessionBag.
var session = GetSession();
var userId = session.UserAuthId;
AuthUserSession if you need to store additional data in the user session.