-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add: auth middleware to handle token, login, register #13
Comments
ghost
self-assigned this
May 9, 2018
Maybe we can add a new class decorator and a column type: 'fixed'. exp:
|
Maybe we can have something like this if is possible to handle with the Decorators, (maybe need a new meta data class) @Route({
url: '/login',
})
class AuthLogin {
@Request('get')
request({username, password}) { // from the params object
if(username === 'admin' && password) {
retrurn this.response({token: 'xxxx'});
} else {
retrurn this.response({error: 'Username or password are wrong'});
}
}
@Respose('JSON')
respose(data) {
return {
...data,
info: {
log_time: Date.now(),
}
}
}
} |
Great! I will implement a standard config for auth server first. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
/token -> GET, no params, need to check authorization header
/login -> POST, {username, password} need to check if user exists
/register -> POST, {username, password} need to check if user already exists
/login and /register could be the same
The text was updated successfully, but these errors were encountered: