• Adding basic files · lcobucci/jwt@aad22ed · GitHub


     
     
    Browse files

    Adding basic files

       
    1 parent cc98635 commit aad22ed9984db99cd2ec01e4b5c209ee273de670@lcobucci  committed on 8 Mar 2014
    Showing with 884 additions and 3 deletions.
        @@ -0,0 +1,5 @@
        +.buildpath
        +.project
        +.settings/
        +vendor
        +build
     
     
     View
    49  README.md
        @@ -1,4 +1,47 @@
        -jwt
        -===
        +# JWT
         
        -A simple library to work with JSON Web Token and JSON Web Signature
        +master [![Build Status](https://secure.travis-ci.org/lcobucci/jwt.png?branch=master)](http://travis-ci.org/#!/lcobucci/jwt)
        +develop [![Build Status](https://secure.travis-ci.org/lcobucci/jwt.png?branch=develop)](http://travis-ci.org/#!/lcobucci/jwt)
        +
        +[![Total Downloads](https://poser.pugx.org/lcobucci/jwt/downloads.png)](https://packagist.org/packages/lcobucci/jwt)
        +[![Latest Stable Version](https://poser.pugx.org/lcobucci/jwt/v/stable.png)](https://packagist.org/packages/lcobucci/jwt)
        +
        +A simple library to work with JSON Web Token and JSON Web Signature (requires PHP 5.5+)
        +
        +## Instalation
        +
        +Just add to your composer.json: ```"lcobucci/jwt": "1.x"```
        +
        +## Basic usage
        +
        +### Creating
        +
        +Just use the builder to create a new JWT/JWS tokens:
        +
        +```php
        +<?php
        +use LcobucciJWTBuilder;
        +use LcobucciJWTSignerSha256;
        +
        +$token = (new Builder())->setIssuer('http://example.com') // Configures the issuer (iss claim)
        + ->setAudience('http://example.org') // Configures the audience (aud claim)
        + ->setId('4f1g23a12aa', true) // Configures the id (jti claim), replicating as a header item
        + ->set('uid', 1) // Configures a new claim, called "uid"
        + ->sign(new Sha256(), 'my key') // Signs the token with HS256 using "my key" as key
        + ->getToken(); // Retrieves the generated token
        +
        +echo $token; // The string representation of the object is a JWT string (pretty easy, right?)
        +```
        +### Parsing from strings
        +
        +Use the parser to create a new token from a JWT string:
        +
        +```php
        +<?php
        +use LcobucciJWTParser;
        +
        +$token = (new Parser())->parse('...'); // Parses from a string
        +$token->getHeader(); // Retrieves the token header
        +$token->getClaims(); // Retrieves the token claims
        +$token->verify('my key'); // Verifies if the signature was created with given key (if token is signed)
        +```
        @@ -0,0 +1,27 @@
        +{
        + "name" : "lcobucci/jwt",
        + "description" : "A simple library to work with JSON Web Token and JSON Web Signature",
        + "type" : "library",
        + "authors" : [{
        + "name" : "Luís Otávio Cobucci Oblonczyk",
        + "email" : "lcobucci@gmail.com",
        + "role": "Developer"
        + }
        + ],
        + "keywords" : ["JWT", "JWS"],
        + "license" : ["BSD-3-Clause"],
        + "require" : {
        + "php" : ">=5.5"
        + },
        + "require-dev" : {
        + "phpunit/phpunit" : "4.0.x",
        + "squizlabs/php_codesniffer" : "*",
        + "phpmd/phpmd" : "*"
        + },
        + "autoload" : {
        + "psr-4" : {
        + "Lcobucci\JWT\" : "src",
        + "Lcobucci\JWT\Test\" : "test"
        + }
        + }
        +}
     

    Large diffs are not rendered by default.

        @@ -0,0 +1,23 @@
        +<?xml version="1.0" encoding="UTF-8"?>
        +<phpunit
        + colors="true"
        + backupGlobals="false"
        + backupStaticAttributes="false"
        + bootstrap="vendor/autoload.php"
        + strict="true">
        + <testsuites>
        + <testsuite name="JWT Test Suite">
        + <directory>test</directory>
        + </testsuite>
        + </testsuites>
        +
        + <filter>
        + <whitelist processUncoveredFilesFromWhitelist="true">
        + <directory suffix=".php">src</directory>
        + </whitelist>
        +
        + <blacklist>
        + <directory suffix=".php">vendor</directory>
        + </blacklist>
        + </filter>
        +</phpunit>

    0 comments on commit aad22ed

     
    Please sign in to comment.
  • 相关阅读:
    查看mysql版本的四种方法及常用命令
    newInstance和new的区别(good)
    Citrix 服务器虚拟化之六 Xenserver虚拟机创建与快照
    Java实现 蓝桥杯 算法训练 排序
    Java实现 蓝桥杯 算法训练 排序
    Java实现 蓝桥杯 算法训练 排序
    Java实现 蓝桥杯 算法训练 2的次幂表示
    Java实现 蓝桥杯 算法训练 2的次幂表示
    Java实现 蓝桥杯 算法训练 前缀表达式
    Java实现 蓝桥杯 算法训练 前缀表达式
  • 原文地址:https://www.cnblogs.com/wzjwffg/p/9884001.html
Copyright © 2020-2023  润新知