Skip to content

Commit

Permalink
fix: simple auth should accept plain text pw
Browse files Browse the repository at this point in the history
  • Loading branch information
spacemeowx2 committed May 6, 2020
1 parent feab06b commit 1c4d887
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion server/src/auth/CustomAuthProvider.ts
@@ -1,14 +1,16 @@
import { BasicAuthProvider, AuthError, AuthErrorType, SHA1 } from './types'

export class CustomAuthProvider extends BasicAuthProvider {
private sha1: Buffer
constructor(private username: string, private password: string) {
super()
this.sha1 = SHA1(this.password)
}

async getUserPasswordSHA1(username: string) {
if (username !== this.username) {
throw new AuthError(AuthErrorType.NoSuchUser, 'No such user')
}
return Buffer.from(this.password, 'hex')
return this.sha1
}
}

0 comments on commit 1c4d887

Please sign in to comment.