github.com/voedger/voedger@v0.0.0-20240520144910-273e84102129/pkg/iauthnzimpl/types.go (about)

     1  /*
     2   * Copyright (c) 2022-present unTill Pro, Ltd.
     3   */
     4  
     5  package iauthnzimpl
     6  
     7  import (
     8  	"context"
     9  
    10  	"github.com/voedger/voedger/pkg/appdef"
    11  	"github.com/voedger/voedger/pkg/iauthnz"
    12  	"github.com/voedger/voedger/pkg/istructs"
    13  )
    14  
    15  type implIAuthorizer struct {
    16  	acl ACL
    17  }
    18  
    19  type implIAuthenticator struct {
    20  	subjectRolesGetter   SubjectGetterFunc
    21  	isDeviceAllowedFuncs IsDeviceAllowedFuncs
    22  }
    23  
    24  type ACElem struct {
    25  	desc    string
    26  	pattern PatternType
    27  	policy  ACPolicyType
    28  }
    29  
    30  type ACL []ACElem
    31  
    32  type PatternType struct {
    33  	opKindsPattern    []iauthnz.OperationKindType
    34  	principalsPattern [][]iauthnz.Principal // first OR, second AND
    35  	qNamesPattern     []appdef.QName
    36  	fieldsPattern     [][]string // first OR, second AND
    37  }
    38  
    39  type ACPolicyType int
    40  
    41  type SubjectGetterFunc = func(requestContext context.Context, name string, as istructs.IAppStructs, wsid istructs.WSID) ([]appdef.QName, error)
    42  
    43  type IsDeviceAllowedFunc = func(as istructs.IAppStructs, requestWSID istructs.WSID, deviceProfileWSID istructs.WSID) (ok bool, err error)
    44  type IsDeviceAllowedFuncs map[istructs.AppQName]IsDeviceAllowedFunc