Git Product home page Git Product logo

redmine-login's Introduction

Redmine Login

Latest Stable Version License Build Status SensioLabsInsight Coverage Status

Install

composer require ekreative/redmine_login

Kernel

new Ekreative\RedmineLoginBundle\EkreativeRedmineLoginBundle()

Parameters

parameters:
    redmine: 'http://www.redmine.org'

Config

ekreative_redmine_login:
    redmine: %redmine%

Routing

ekreative_redmine_login:
    resource: "@EkreativeRedmineLoginBundle/Resources/config/routing.yml"

Security

security:

    providers:
        webservice:
            id: ekreative_redmine_login.provider

    firewalls:
        unsec:
            pattern: ^/login$
            security: false

        secured_area:
            pattern: ^/
            anonymous:
            simple_form:
                authenticator: ekreative_redmine_login.authenticator
                check_path:    login_check
                login_path:    login
                username_parameter: login[username]
                password_parameter: login[password]
            simple_preauth:
                authenticator: ekreative_redmine_login.api_authenticator
            logout:
                path: /logout

    access_control:
        - { path: ^/login, roles: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/, roles: ROLE_REDMINE }

Security

You can secure your own routes using two roles

  • ROLE_REDMINE
  • ROLE_REDMINE_ADMIN

Make Request

$projects = json_decode($this->get('ekreative_redmine_login.client_provider')->get($this->getUser())->get('projects.json')->getBody(), true)['projects']

Login as api user

POST /login HTTP/1.1
Content-Type: application/json

{
    "login": {
        "username": "username",
        "password": "password"
    }
}

Response

200 OK

{
  "user": {
    "id": 1,
    "username": "username",
    "firstName": "Name",
    "lastName": "Last",
    "email": "[email protected]",
    "createdAt": "2000-01-01T00:00:00+00:00",
    "lastLoginAt": "2000-01-01T00:00:00+00:00",
    "apiKey": "your_api_key",
    "status": 1
  }
}

Logged in:

GET /admin HTTP/1.1
Host: 127.0.0.1:8000
X-API-Key: your_api_key

Custom user class

If you want to use a custom user class then its very easy! There are two ways

  • Either override the parameter ekreative_redmine_login.user.class with the name of your own class that extends RedmineUser.

  • Or override the service ekreative_redmine_login.user_factory with a service that implements RedmineUserFactoryInterface. You will want to do this if you are using Doctrine.

RedmineUser contains all the annotations for use with Doctrine, so its super simple to store users in the database.

Api Doc

If you want the api doc to be listed then use NelmioApiDocBundle

Kernel

new Nelmio\ApiDocBundle\NelmioApiDocBundle()

Routing

NelmioApiDocBundle:
    resource: "@NelmioApiDocBundle/Resources/config/routing.yml"
    prefix:   /api/doc

Security

Replace the standard unsec

unsec:
    pattern: ^/(login$|api/doc)
    security: false

redmine-login's People

Contributors

mcfedr avatar vashu avatar alexgoncharcherkassy avatar smagolexandr avatar ahonymous avatar nonanerz avatar

Stargazers

Anton Hubariev avatar  avatar Vitaliy Pitvalo avatar

Watchers

 avatar James Cloos avatar Vitaliy Pitvalo avatar  avatar

redmine-login's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.