skelpo / usermanager Goto Github PK
View Code? Open in Web Editor NEWA small, useful user manager made for production application setups.
Home Page: https://www.skelpo.com
License: MIT License
A small, useful user manager made for production application setups.
Home Page: https://www.skelpo.com
License: MIT License
Hi,
Could you please help with generating right JWT_PUBLIC and JWT_SECRET?
I'm generating RSA key:
openssl genrsa -out rsa-1024.pem 1024
Then I'm using script from here - #12 and getting N and D
N:
4BuKaDkZohgQLHs0UnWslEP6K7hv9woHOP7jLN/c+YVVcsZjBVQ6IdkLEm6L9E+bENDSAdyVNdQOAAz6gcsSoQzmvNQ5HFpqdnOUH0Qnv4o0fQiAJUalO7y5O0ON9nHvKQRaOnifSPlg9l7ZDwNttz5w7K+FVkmNqHKrtmSVkQU=
D:
AJDffOPPNdDheWMn6jT8OSpHn2uv+UFbzDt+GmGh/fmXxhtCQDTrtAC5jDzIFdVDuNxwAbKOZC69/KbvvOk227zmxtlWbZeFUptwd/bEHbID061E27bQ6VOQl63kCb3WO4f5efXxNvLvxI/fFJX9t9ICJC73n1C+wteXIOzN0Cep
But it doesn't work like that.
We need functions that are only available to admin users. These include:
Creates routes where a user can view and delete all their data:
GET /user/data
DELETE /user/data
@calebkleveter test with this send grid key: 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
If you need anything else let me know. Also make sure it uses the localizations properly.
Note: I've made the emailFrom & emailUrl come from the environment variables as well.
UserManager/Sources/App/Controllers/AdminController.swift:17:13: error: generic type 'PermissionsMiddleware' specialized with too many typeparameters (got 2, but expected 1)
PermissionsMiddleware<UserStatus, Payload>(allowed: [.admin]),
^ ~~~~~~~~~~~~~~~~~~~~~
JWTMiddleware.PermissionsMiddleware:1:20: note: generic type 'PermissionsMiddleware' declared here
final public class PermissionsMiddleware<Payload> : Middleware where Payload : PermissionedUserPayload {
^
UserManager/Sources/App/Controllers/AuthController.swift:22:39: error: generic type 'PermissionsMiddleware' specialized with too many type parameters (got 2, but expected 1)
let restricted = auth.grouped(PermissionsMiddleware<UserStatus, Payload>(allowed: [.admin]))
^ ~~~~~~~~~~~~~~~~~~~~~
JWTMiddleware.PermissionsMiddleware:1:20: note: generic type 'PermissionsMiddleware' declared here
final public class PermissionsMiddleware<Payload> : Middleware where Payload : PermissionedUserPayload {
^
error: terminated(1):
Add third-party OAuth methods: FB, Twitter, Google, etc
Could you please explain how to generate this N and D values from JWT? I used JWT with NodeJS but never faced with a manual configuration of those parameters.
Hey @proggeramlug, I tried to walk through register and login method implementations and came up with some questions:
We need to be sure this actually does what is says.
I plan to run some local tests and the replace a vapor-2 instance of this service that is used in production. Once this is confirmed we can go public.
Just like in the vapor 2 version, we need the option for other services like teams, billing etc. to infiltrate their information into the JWT token.
When sending an empty POST request to */users/register I'm getting:
{
"error": true,
"reason": "Value of type 'String' required for key ''."
}
When registering the email code for the user is in the API response - that should be hidden. :)
A setting (like the emailconfirmation one) shoul indicate whether or not the public can register themselves. If so the users/register route needs to be protected, if not it can be public.
Hi,
I have been trouble getting the docker build
command to work. I am repeatedly receiving the error /root/vapor: error: package at '/root/vapor' requires a minimum Swift tools version of 5.0.0 (currently 4.2.0)
. I upgraded to the latest Xcode 11 Beta and selected the latest tools using sudo xcode-select -s /Applications/Xcode-beta.app/Contents/Developer
. Running swiftenv I can see that the selected swift tools are 5.0 at the repository.
Any help would be greatly appreciated!
I ran the following command replacing the JWT_PUBLIC
and JWT_SECRET
values with generated rsa public and private keys,
docker build . -t users
docker run -e JWT_PUBLIC='n-value-from-jwt' \
-e DATABASE_HOSTNAME='localhost' \
-e DATABASE_USER='users_service' \
-e DATABASE_PASSWORD='users_service' \
-e DATABASE_DB='users_service' \
-e JWT_SECRET='d-value-from-jwt' -p 8080:8080 users
Here are the logs from running the getting started command.
Sending build context to Docker daemon 120.8MB
Step 1/25 : FROM swift:4.2
---> ce1fe933c297
Step 2/25 : ARG ENVIRONMENT
---> Using cache
---> 52c9704beb14
Step 3/25 : ENV ENVIRONMENT ${ENVIRONMENT:-production}
---> Using cache
---> 525c39d43606
Step 4/25 : ENV DEBIAN_FRONTEND noninteractive
---> Using cache
---> 6a1dcf17f6cf
Step 5/25 : ENV TZ=Europe/Berlin
---> Using cache
---> be3ab5a1e6fc
Step 6/25 : ENV TERM xterm
---> Using cache
---> 509a1f6fd08d
Step 7/25 : RUN apt-get update && apt-get -y install wget lsb-release apt-transport-https
---> Using cache
---> 1119f8522a86
Step 8/25 : RUN wget -q https://repo.vapor.codes/apt/keyring.gpg -O- | apt-key add -
---> Using cache
---> 7025dc9a6736
Step 9/25 : RUN echo "deb https://repo.vapor.codes/apt $(lsb_release -sc) main" | tee /etc/apt/sources.list.d/vapor.list
---> Using cache
---> 4f2e17d46633
Step 10/25 : RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
---> Using cache
---> f2a799ef60eb
Step 11/25 : USER root
---> Using cache
---> 150ff5afb19f
Step 12/25 : RUN apt-get update && apt-get install
---> Using cache
---> e6fea8edc4c2
Step 13/25 : RUN mkdir /root/vapor
---> Using cache
---> c0b471d1d3d0
Step 14/25 : ADD . /root/vapor
---> Using cache
---> 48103aec8142
Step 15/25 : WORKDIR /root/vapor
---> Using cache
---> a0af880d3b4f
Step 16/25 : RUN cd /root/vapor && rm -rf .build
---> Using cache
---> 8c070f77c9a0
Step 17/25 : RUN swift package update
---> Running in d7df9175b541
/root/vapor: error: package at '/root/vapor' requires a minimum Swift tools version of 5.0.0 (currently 4.2.0)
The command '/bin/sh -c swift package update' returned a non-zero code: 1
Unable to find image 'users:latest' locally
docker: Error response from daemon: pull access denied for users, repository does not exist or may require 'docker login'.
Thanks!
I need to make the dockerfile actually work with this new version. :)
The README documentation is outdated, with instructions on the JSON config files and other things that have been removed in Vapor 3. The README should be updated for the new platform.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.