models

package
v0.0.0-...-90ba4ba Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2026 License: Apache-2.0 Imports: 1 Imported by: 3

Documentation

Overview

* Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com). * * WSO2 LLC. licenses this file to you under the Apache License, * Version 2.0 (the "License"); you may not use this file except * in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthConfig

type AuthConfig struct {
	// Basic Auth Configuration
	BasicAuth *BasicAuth

	// JWT/Bearer Auth Configuration
	JWTConfig *IDPConfig

	// Paths to skip authentication
	SkipPaths []string

	// Allow either basic or bearer (if true), require both (if false and both configured)
	AllowEither bool

	// ResourceRoles holds the mapping of resource -> allowed local roles.
	// Keys may be either "METHOD /path" (preferred) or just "/path".
	ResourceRoles map[string][]string `json:"resource_roles"`
}

AuthConfig holds configuration for the authentication middleware

type AuthContext

type AuthContext struct {
	Authenticated bool
	UserID        string
	Roles         []string
	Claims        any
}

AuthContext is a packed authentication/authorization context that can be attached to a request context and passed downstream.

This avoids setting and reading multiple independent context keys. Claims is kept as 'any' to avoid coupling common/models to a specific JWT library type.

type BasicAuth

type BasicAuth struct {
	Enabled bool   `json:"enabled"`
	Users   []User `json:"users"`
}

type IDPConfig

type IDPConfig struct {
	Enabled               bool                 `json:"enabled"`
	IssuerURL             string               `json:"issuer_url"`
	JWKSUrl               string               `json:"jwks_url"`
	ScopeClaim            string               `json:"scope_claim"`
	UsernameClaim         string               `json:"username_claim"`
	Audience              *[]string            `json:"audience"`
	Certificate           *string              `json:"certificate"`
	ClaimMapping          *map[string]string   `json:"claim_mapping"`
	PermissionMapping     *map[string][]string `json:"permission_mapping"`
	InsecureSkipVerifyTLS bool                 `json:"insecure_skip_verify_tls"`
	JWTLeeway             *time.Duration       `json:"jwt_leeway"`
}

IDPConfig holds identity provider configuration

type User

type User struct {
	Username       string   `json:"username"`
	Password       string   `json:"password"`
	PasswordHashed bool     `json:"password_hashed"`
	Roles          []string `json:"roles"`
}

User represents a user in the system

Jump to

Keyboard shortcuts

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