Giter VIP home page Giter VIP logo

dappy's Introduction

Basic LDAP client for Go

GoDoc Report Card

LDAP is complicated. Many times, all you really need to do is authenticate users with it. This package boils down LDAP functionality to User Authentication, that's it.

Thanks to https://github.com/go-ldap/ldap

go get github.com/nerney/dappy

Example:

package main

import (
	"log"

	"github.com/nerney/dappy"
)

func main() {
	var client dappy.Client
	var err error

	// create a new client
	if client, err = dappy.New(dappy.Config{
		BaseDN: "dc=example,dc=com",
		Filter: "uid",
		ROUser: dappy.User{Name: "cn=read-only-admin,dc=example,dc=com", Pass: "password"},
		Host:   "ldap.forumsys.com:389",
	}); err != nil {
		panic(err)
	}

	// username and password to authenticate
	username := "tesla"
	password := "password"

	// attempt the authentication
	if err := client.Auth(username, password); err != nil {
		panic(err)
	} else {
		log.Println("Success!")
	}
}

dappy's People

Contributors

nerney avatar reallinfo avatar stefanb avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

dappy's Issues

Logo contribution

Hello! @nerney

Hello! @monch1962 I wanted to contribute. That's why, i designed a logo for dappy. I have combined a Authenticator and the first letter of the software. What do you think? I will wait for feedback.

Have a nice day!

dappy

θΏ™δΈͺζŠ₯ι”™ζ˜―δΈΊδ»€δΉˆ

unable to read LDAP response packet: read tcp 172.20.20.132:53401->192.168.111.10:636: read: connection reset by peer
/Users/wuyongjie/Code/GO/src/go-answer/pkg/ldap/ldap.go:19 (0x177b3b9)
Ldap_Authenticate: panic(err)

Differentiate input errors from other internal errors

There are two types of errors:

  1. Input errors, which should be treated as soft failures
    • Not found: the input username does not exist
    • Invalid Credentials: the input password does not match the given username
  2. Internal Errors, which should be treated as hard failures
    • The given ROUser is not valid
    • The given BaseDN does not exist
    • The given Host can not be connected
    • The given Filter has a syntax error
    • Other errors from the LDAP server

Also, the existing input errors can not be compared in an idiomatic way.

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.