informaticauco/simplesamlphp-module-ucofilter 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

informaticauco/simplesamlphp-module-ucofilter

Composer 安装命令:

composer require informaticauco/simplesamlphp-module-ucofilter

包简介

A SimpleSAMLphp module to filter our own attributes

README 文档

README

This module can be used to add or change attributes using the ExpressionLanguage Symfony component.

Requirements

  • PHP>=5.5

Installation

Installation can be as easy as executing:

bash$ composer require informaticauco/simplesamlphp-module-ucofilter

Uso

From any entity that supports filters (Authentication Processing Filters or authproc) we can use this module in this way:

<?php

use SimpleSAML\Modules\UcoFilter\Auth\Process\UcoFilter;

$config = array(
    // ...
    
    50 => array(
        'class' => UcoFilter::class,
        // (Optional) This filter only is executed is almost one rule is true
        // Default -> 'rules' => ['true']
        'rules' => [
            '"sp-remote-id" in request["saml:RequesterID"]',
        ],
        // (Optional) Reset the next attributes before to add new values
        // Default -> 'reset' => []
        'reset' => [
            'eduPersonPrincipalName',
        ],
        // (Required) Create new attributes
        'mapping' => array (
            // Concatenation example without rules
            // firstName, middleName and lastName exists in Attributes.
            'commonName' => 'firstName[0]~" "~middleName[0]~" "~lastName[0]',
            
            // Multiple attributes
            'eduPersonPrincipalName' => [
                'uid[0]',  
                'mail[0]',
                'commonName[0]' // previous attributes are available
            ],
            
            // Complete syntax with rules
            'groups' => [
                // value expression => rule expression
                // value only is added if the rule is true
                '"staff"' => 'in_attribute(attributes["uid"], ["username1", "username2])',
                '"guest"', // always true
                '"student"' => 'attributes["uid"][0] matches "/^alum\d+/"',
            ],
        ),
    ),
    // ...    
);

ExpressionLanguage reference

Functions

This methods are available inside the expressions:

  • string md5(string): call to PHP md5 method
  • string sha1(string): call to PHP sha1 method
  • bool in_attribute(array, array): search if exists elements from first array in second array. Useful to check if an attribute has a value.

Variables

Value expressions receives all the request attributes as variables. V.g: $request['Attributes']['uid'] will be accessible as uid variable inside expression. Remember than all attributes are arrays.

Rule expressions has three variables:

  • request: The complete request
  • attributes: Only attributes
  • value: The value to be assigned if the rule is true

Syntax

To see the complete syntax supported by the Expression Language component see the
official documentation site.

统计信息

  • 总下载量: 126
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-11-02

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固