Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/tendant/simple-idm


https://github.com/tendant/simple-idm

Last synced: about 1 month ago
JSON representation

Awesome Lists containing this project

README

        

# sqlc installation

go install github.com/sqlc-dev/sqlc/cmd/sqlc@latest

# Testing commands

curl -i -X POST localhost:4000/api/users -d '{"email": "[email protected]"}' -H "Content-Type: application/json"

curl -i localhost:4000/api/users

# Create database

CREATE Role idm WITH PASSWORD 'pwd';
CREATE DATABASE idm_db ENCODING 'UTF8' OWNER idm;
GRANT ALL PRIVILEGES ON DATABASE idm_db TO idm;
ALTER ROLE idm WITH LOGIN;

# Run Migraion

make migrate-up-idm

# Fix Database

ALTER TABLE users OWNER TO idm;


# Insert users record

INSERT INTO users (username, name, password, email, created_by)
VALUES ('admin', 'admin', convert_to('pwd', 'UTF8'), '[email protected]', 'system');

# Insert roles record

INSERT INTO roles (role_name, description)
VALUES ('admin', 'Administrator with full access');

# Insert user_roles record

select * from users;
select * from roles;
INSERT INTO user_roles (user_uuid, role_uuid)
VALUES ('user-uuid-example-1234', 'role-uuid-example-5678');


# API Test Commands

## Create User

curl -i -X POST localhost:4000/api/v4/user --data '{"name":"xyz", "email": "abc"}' --header "Content-Type: application/json"

## Login

curl -i -X POST localhost:4000/login --data '{"username":"admin", "password": "pwd"}' --header "Content-Type: application/json"