github.com/greenpau/go-authcrunch@v1.1.4/pkg/authz/options/options.go (about)

     1  // Copyright 2022 Paul Greenberg greenpau@outlook.com
     2  //
     3  // Licensed under the Apache License, Version 2.0 (the "License");
     4  // you may not use this file except in compliance with the License.
     5  // You may obtain a copy of the License at
     6  //
     7  //     http://www.apache.org/licenses/LICENSE-2.0
     8  //
     9  // Unless required by applicable law or agreed to in writing, software
    10  // distributed under the License is distributed on an "AS IS" BASIS,
    11  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12  // See the License for the specific language governing permissions and
    13  // limitations under the License.
    14  
    15  package options
    16  
    17  // TokenValidatorOptions provides options for TokenValidator.
    18  type TokenValidatorOptions struct {
    19  	ValidateSourceAddress       bool `json:"validate_source_address,omitempty" xml:"validate_source_address,omitempty" yaml:"validate_source_address,omitempty"`
    20  	ValidateBearerHeader        bool `json:"validate_bearer_header,omitempty" xml:"validate_bearer_header,omitempty" yaml:"validate_bearer_header,omitempty"`
    21  	ValidateMethodPath          bool `json:"validate_method_path,omitempty" xml:"validate_method_path,omitempty" yaml:"validate_method_path,omitempty"`
    22  	ValidateAccessListPathClaim bool `json:"validate_access_list_path_claim,omitempty" xml:"validate_access_list_path_claim,omitempty" yaml:"validate_access_list_path_claim,omitempty"`
    23  }
    24  
    25  // TokenGrantorOptions provides options for TokenGrantor.
    26  type TokenGrantorOptions struct {
    27  	EnableSourceAddress bool `json:"enable_source_address,omitempty" xml:"enable_source_address,omitempty" yaml:"enable_source_address,omitempty"`
    28  }
    29  
    30  // NewTokenValidatorOptions returns an instance of TokenValidatorOptions
    31  func NewTokenValidatorOptions() *TokenValidatorOptions {
    32  	return &TokenValidatorOptions{}
    33  }
    34  
    35  // NewTokenGrantorOptions returns an instance of TokenGrantorOptions
    36  func NewTokenGrantorOptions() *TokenGrantorOptions {
    37  	return &TokenGrantorOptions{}
    38  }