iam

package
v0.10.13 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 8, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetSessionExpiration added in v0.10.5

func GetSessionExpiration() time.Duration

GetSessionExpiration returns the configured session expiration time. If not configured, it returns the default value of 8 hours.

func Register

func Register(config ...Config)

Register registers iam modules,

Models:

  • ChangePassword
  • Group
  • Heartbeat
  • Login
  • Logout
  • Offline
  • Me
  • OnlineUser
  • Signup
  • Tenant
  • User

Routes:

  • POST /api/iam/change-password
  • POST /api/iam/groups
  • DELETE /api/iam/groups/:id
  • PUT /api/iam/groups/:id
  • PATCH /api/iam/groups/:id
  • GET /api/iam/groups
  • GET /api/iam/groups/:id
  • POST /api/heartbeat
  • POST /api/login
  • POST /api/logout
  • POST /api/offline
  • GET /api/me
  • GET /api/online-users
  • POST /api/signup
  • POST /api/iam/tenants
  • DELETE /api/iam/tenants/:id
  • PUT /api/iam/tenants/:id
  • PATCH /api/iam/tenants/:id
  • GET /api/iam/tenants
  • GET /api/iam/tenants/:id
  • POST /api/iam/users
  • DELETE /api/iam/users/:id
  • PUT /api/iam/users/:id
  • PATCH /api/iam/users/:id
  • GET /api/iam/users
  • GET /api/iam/users/:id

Middleware:

  • IAMSession

Default disable Tenant module, use `EnableTenant` to enable it. Default session expiration time is 8 hours, use `SessionExpiration` to customize it.

NOTE: iam modules register must before "authz" modules register. because "authz" registered middleware "Authz" depend on iam modules registered middleware "IAMSession".

Types

type ChangePassword

type ChangePassword = modeliam.ChangePassword

type ChangePasswordModule

type ChangePasswordModule struct{}

func (*ChangePasswordModule) Param

func (*ChangePasswordModule) Param() string

func (*ChangePasswordModule) Pub

func (*ChangePasswordModule) Pub() bool

func (*ChangePasswordModule) Route

func (*ChangePasswordModule) Route() string

func (*ChangePasswordModule) Service

type ChangePasswordReq

type ChangePasswordReq = modeliam.ChangePasswordReq

type ChangePasswordRsp

type ChangePasswordRsp = modeliam.ChangePasswordRsp

type ChangePasswordService

type ChangePasswordService = serviceiam.ChangePasswordService

type Config

type Config struct {
	EnableTenant      bool          // EnableTenant enables tenant module, default is false
	DefaultUsers      []*User       // DefaultUsers are default users to create on registration
	SessionExpiration time.Duration // SessionExpiration is the session expiration time, default is 8 hours
}

Config is the configuration for iam module.

type Group

type Group = modeliam.Group

type GroupModule

type GroupModule struct{}

func (*GroupModule) Param

func (*GroupModule) Param() string

func (*GroupModule) Pub

func (*GroupModule) Pub() bool

func (*GroupModule) Route

func (*GroupModule) Route() string

func (*GroupModule) Service

func (*GroupModule) Service() types.Service[*Group, *Group, *Group]

type GroupService

type GroupService = serviceiam.GroupService

type Heartbeat

type Heartbeat = modeliam.Heartbeat

type HeartbeatModule

type HeartbeatModule struct{}

func (*HeartbeatModule) Param

func (*HeartbeatModule) Param() string

func (*HeartbeatModule) Pub

func (*HeartbeatModule) Pub() bool

func (*HeartbeatModule) Route

func (*HeartbeatModule) Route() string

func (*HeartbeatModule) Service

type HeartbeatService

type HeartbeatService = serviceiam.HeartbeatService

type Login

type Login = modeliam.Login

type LoginModule

type LoginModule struct{}

func (*LoginModule) Param

func (*LoginModule) Param() string

func (*LoginModule) Pub

func (*LoginModule) Pub() bool

func (*LoginModule) Route

func (*LoginModule) Route() string

func (*LoginModule) Service

func (*LoginModule) Service() types.Service[*Login, *LoginReq, *LoginRsp]

type LoginReq

type LoginReq = modeliam.LoginReq

type LoginRsp

type LoginRsp = modeliam.LoginRsp

type LoginService

type LoginService = serviceiam.LoginService

type Logout

type Logout = modeliam.Logout

type LogoutModule

type LogoutModule struct{}

func (*LogoutModule) Param

func (*LogoutModule) Param() string

func (*LogoutModule) Pub

func (*LogoutModule) Pub() bool

func (*LogoutModule) Route

func (*LogoutModule) Route() string

func (*LogoutModule) Service

func (*LogoutModule) Service() types.Service[*Logout, *Logout, *LogoutRsp]

type LogoutRsp

type LogoutRsp = modeliam.LogoutRsp

type LogoutService

type LogoutService = serviceiam.LogoutService

type Me

type Me = modeliam.Me

type MeModule

type MeModule struct{}

func (*MeModule) Param

func (*MeModule) Param() string

func (*MeModule) Pub

func (*MeModule) Pub() bool

func (*MeModule) Route

func (*MeModule) Route() string

func (*MeModule) Service

func (*MeModule) Service() types.Service[*Me, *Me, MeRsp]

type MeRsp

type MeRsp = modeliam.MeRsp

type MeService

type MeService = serviceiam.MeService

type Offline

type Offline = modeliam.Offline

type OfflineModule

type OfflineModule struct{}

func (*OfflineModule) Param

func (*OfflineModule) Param() string

func (*OfflineModule) Pub

func (*OfflineModule) Pub() bool

func (*OfflineModule) Route

func (*OfflineModule) Route() string

func (*OfflineModule) Service

type OfflineReq

type OfflineReq = modeliam.OfflineReq

type OfflineService

type OfflineService = serviceiam.OfflineService

type OnlineUser

type OnlineUser = modeliam.OnlineUser

type OnlineUserModule

type OnlineUserModule struct{}

func (*OnlineUserModule) Param

func (*OnlineUserModule) Param() string

func (*OnlineUserModule) Pub

func (*OnlineUserModule) Pub() bool

func (*OnlineUserModule) Route

func (*OnlineUserModule) Route() string

func (*OnlineUserModule) Service

type OnlineUserService

type OnlineUserService = serviceiam.OnlineUserService

type Session

type Session = modeliam.Session

type Signup

type Signup = modeliam.Signup

type SignupModule

type SignupModule struct{}

func (*SignupModule) Param

func (*SignupModule) Param() string

func (*SignupModule) Pub

func (*SignupModule) Pub() bool

func (*SignupModule) Route

func (*SignupModule) Route() string

func (*SignupModule) Service

type SignupReq

type SignupReq = modeliam.SignupReq

type SignupRsp

type SignupRsp = modeliam.SignupRsp

type SignupService

type SignupService = serviceiam.SignupService

type Tenant

type Tenant = modeliam.Tenant

type TenantModule

type TenantModule struct{}

func (*TenantModule) Param

func (*TenantModule) Param() string

func (*TenantModule) Pub

func (*TenantModule) Pub() bool

func (*TenantModule) Route

func (*TenantModule) Route() string

func (*TenantModule) Service

func (*TenantModule) Service() types.Service[*Tenant, *Tenant, *Tenant]

type TenantService

type TenantService = serviceiam.TenantService

type Token

type Token = modeliam.Token

type User

type User = modeliam.User

type UserModule

type UserModule struct{}

func (*UserModule) Param

func (*UserModule) Param() string

func (*UserModule) Pub

func (*UserModule) Pub() bool

func (*UserModule) Route

func (*UserModule) Route() string

func (*UserModule) Service

func (*UserModule) Service() types.Service[*User, *User, *User]

type UserService

type UserService = serviceiam.UserService

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL