This commit is contained in:
Douglas Barone 2023-10-19 07:34:21 -04:00
parent 1217b53213
commit 2771b3cd96
3 changed files with 5 additions and 5 deletions

View File

@ -1,6 +1,6 @@
import { Client } from 'ldapts'
export class LdapLogin implements Login {
export class LdapAuth implements Auth {
constructor(
private client: Client,
private domain: string,

View File

@ -4,6 +4,6 @@ type LoginResult = {
jwt?: string
}
interface Login {
interface Auth {
login(username: string, password: string): Promise<LoginResult>
}

View File

@ -1,15 +1,15 @@
import { Client } from 'ldapts'
import { LdapLogin } from '../classes/LdapLogin'
import { LdapAuth } from '../Auth/LdapAuth'
export async function login(username: string, password: string) {
const ldapClient = new Client({
url: 'ldap://10.7.0.18'
})
const ldapLogin = new LdapLogin(ldapClient, 'ifms', 'DC=ifms,DC=edu,DC=br')
const ldapAuth = new LdapAuth(ldapClient, 'ifms', 'DC=ifms,DC=edu,DC=br')
const result = await ldapLogin.login(username, password)
const result = await ldapAuth.login(username, password)
console.log('Login result:', result)