{"id":20980517,"url":"https://github.com/hyperjumptech/hansip","last_synced_at":"2025-05-14T15:30:45.811Z","repository":{"id":54501444,"uuid":"286358215","full_name":"hyperjumptech/hansip","owner":"hyperjumptech","description":"Another simplified AAA server","archived":false,"fork":false,"pushed_at":"2021-10-24T06:43:53.000Z","size":13990,"stargazers_count":13,"open_issues_count":1,"forks_count":3,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-04-02T20:05:04.418Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hyperjumptech.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE-2.0.txt","code_of_conduct":"CODE_OF_CONDUCTS.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-08-10T02:35:13.000Z","updated_at":"2023-06-19T10:13:06.000Z","dependencies_parsed_at":"2022-08-13T18:00:19.265Z","dependency_job_id":null,"html_url":"https://github.com/hyperjumptech/hansip","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hyperjumptech%2Fhansip","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hyperjumptech%2Fhansip/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hyperjumptech%2Fhansip/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hyperjumptech%2Fhansip/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hyperjumptech","download_url":"https://codeload.github.com/hyperjumptech/hansip/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254171553,"owners_count":22026464,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-19T05:28:59.567Z","updated_at":"2025-05-14T15:30:40.798Z","avatar_url":"https://github.com/hyperjumptech.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Hansip \r\n\r\nAn AAA (Access Authentication \u0026 Authorization) Service by Hyperjump \r\n\r\n## Building Hansip\r\n\r\nPrerequisites:\r\n\r\n1. Golang 1.13\r\n2. Make utility\r\n\r\n**Step 1 Checkout and Install Go-Resource**\r\n\r\n```.bash\r\n$ git clone https://github.com/newm4n/go-resource.git\r\n$ cd go-resource\r\n$ go install\r\n```\r\n\r\n**Step 2 Checkout Hansip**\r\n\r\n```.bash\r\n$ git clone https://github.com/hyperjumptech/hansip.git\r\n$ cd hansip\r\n```\r\n\r\n**Step 3 Build and Run**\r\n\r\n```bash\r\n$ make build\r\n```\r\n\r\nRunning the app will automatically build.\r\n\r\n```bash\r\n$ make run\r\n```\r\n\r\n## Testing Hansip\r\n\r\n```bash\r\n$ make test\r\n``` \r\n\r\n## Configuring Hansip\r\n\r\nIf you want to run Hansip from the make file using `make run` command, you have to\r\nmodify the environment variable in the `run` phase.\r\n\r\n```make\r\nrun: build\r\n\texport AAA_SERVER_HOST=localhost; \\\r\n\texport AAA_SERVER_PORT=8088; \\\r\n\texport AAA_SETUP_ADMIN_ENABLE=true; \\\r\n\t./$(IMAGE_NAME).app\r\n\trm -f $(IMAGE_NAME).app\r\n```\r\n\r\nYou can change the import env variable.\r\n\r\nIf you're running from docker, you should modify the environment variable for the running\r\nimage.\r\n\r\n### Environment Variable Values \r\n\r\n| Variable | Environment Variable | Default | Description |\r\n| -------- | -------------------- | ------- | ----------- |\r\n| server.host| AAA_SERVER_HOST | localhost | The host name to bind. could be `localhost` or `0.0.0.0` |\r\n| server.port| AAA_SERVER_PORT | 3000 | The host port to listen from |\r\n| server.timeout.write| AAA_SERVER_TIMEOUT_WRITE | 15 seconds | Server write timeout |\r\n| server.timeout.read| AAA_SERVER_TIMEOUT_READ | 15 seconds | Server read timeout |\r\n| server.timeout.idle| AAA_SERVER_TIMEOUT_IDLE | 60 seconds | Server connection IDLE timeout |\r\n| server.timeout.graceshut| AAA_SERVER_TIMEOUT_GRACESHUT | 15 seconds | Server grace shutdown timeout |\r\n| setup.admin.enable| AAA_SETUP_ADMIN_ENABLE | false | Enable built in admin account |\r\n| setup.admin.email| AAA_SETUP_ADMIN_EMAIL |admin@hansip | Built in admin email address for authentication |\r\n| setup.admin.passphrase| AAA_SETUP_ADMIN_PASSPHRASE |this must be change in the production | Built in admin password for authentication |\r\n| token.issuer| AAA_TOKE_ISSUER |aaa.domain.com | JWT Token issuer value |\r\n| token.access.duration| AAA_ACCESS_DURATION |5 minutes | JWT Access token lifetime |\r\n| token.refresh.duration| AAA_REFRESH_DURATION |1 year | JWT Refresh token lifetime |\r\n| token.crypt.key| AAA_TOKEN_CRYPT_KEY |th15mustb3CH@ngedINprodUCT10N | JWT token crypto key |\r\n| token.crypt.method| AAA_TOKEN_CRYPT_METHOD |HS512 | JWT token crypto method |\r\n| db.type| AAA_DB_TYPE | INMEMORY | Database type. `INMEMORY` or `MYSQL` |\r\n| db.mysql.host| AAA_DB_MYSQL_HOST |localhost | MySQL host |\r\n| db.mysql.port| AAA_DB_MYSQL_PORT |3306 | MySQL Port |\r\n| db.mysql.user| AAA_DB_MYSQL_USER |user | MySQL User to login |\r\n| db.mysql.password| AAA_DB_MYSQL_PASSWORD |password | MySQL Password to login |\r\n| db.mysql.database| AAA_DB_MYSQL_DATABASE |hansip | MySQL Database to use |\r\n| db.mysql.maxidle| AAA_DB_MYSQL_MAXIDLE |3 | Maximum connection that can IDLE  |\r\n| db.mysql.maxopen| AAA_DB_MYSQL_MAXOPEN |10 | Maximum open connection in the pool |\r\n| mailer.type| AAA_MAILER_TYPE | DUMMY | Mailer type. `DUMMY` or `SENDMAIL` |\r\n| mailer.from| AAA_MAILER_FROM |hansip@aaa.com | The email from field |\r\n| mailer.sendmail.host| AAA_MAILER_SENDMAIL_HOST |localhost | Mail server host |\r\n| mailer.sendmail.port| AAA_MAILER_SENDMAIL_PORT |25 | Mail server port |\r\n| mailer.sendmail.user| AAA_MAILER_SENDMAIL_USER |sendmail | Mail server user for authentication |\r\n| mailer.sendmail.password| AAA_MAILER_SENDMAIL_PASSWORD |password | Mail server password for authentication |\r\n| mailer.templates.emailveri.subject| AAA_MAILER_TEMPLATES_EMAILVERI_SUBJECT |Please verify your new Hansip account's email | Email verification subject template |\r\n| mailer.templates.emailveri.body| AAA_MAILER_TEMPLATES_EMAILVERI_BODY | `\u003chtml\u003e\u003cbody\u003eDear New Hansip User\u003cbr\u003e\u003cbr\u003eYour new account is ready!\u003cbr\u003eplease click this \u003ca href=\\\"http://hansip.io/activate?code={{.ActivationCode}}\\\"\u003elink to activate\u003c/a\u003e your account.\u003cbr\u003e\u003cbr\u003eCordially,\u003cbr\u003eHANSIP team\u003c/body\u003e\u003c/html\u003e` | Email verification body template |\r\n| mailer.templates.passrecover.subject| AAA_MAILER_TEMPLATES_PASSRECOVER_SUBJECT | Passphrase recovery instruction | Password recovery email subject template |\r\n| mailer.templates.passrecover.body| AAA_MAILER_TEMPLATES_PASSRECOVER_BODY | `\u003chtml\u003e\u003cbody\u003eDear Hansip User\u003cbr\u003e\u003cbr\u003eTo recover your passphrase\u003cbr\u003eplease click this \u003ca href=\\\"http://hansip.io/activate?code={{.RecoveryCode}}\\\"\u003elink to change your passphrase\u003c/a\u003e.\u003cbr\u003e\u003cbr\u003eCordially,\u003cbr\u003eHANSIP team\u003c/body\u003e\u003c/html\u003e` | Password recovery email body template |\r\n| server.http.cors.enable | AAA_SERVER_HTTP_CORS_ENABLE | true | To enable or disable CORS handling | \r\n| server.http.cors.allow.origins | AAA_SERVER_HTTP_CORS_ALLOW_ORIGINS | * |  Indicates whether the response can be shared with requesting code from the given origin. | \r\n| server.http.cors.allow.credential | AAA_SERVER_HTTP_CORS_ALLOW_CREDENTIAL | true | response header tells browsers whether to expose the response to frontend JavaScript code when the request's credentials mode (`Request.credentials`) is `include` | \r\n| server.http.cors.allow.method | AAA_SERVER_HTTP_CORS_ALLOW_METHOD | GET,PUT,DELETE,POST,OPTIONS | response header specifies the method or methods allowed when accessing the resource in response to a preflight request. | \r\n| server.http.cors.allow.headers | AAA_SERVER_HTTP_CORS_ALLOW_HEADERS | Accept,Authorization,Content-Type,X-CSRF-TOKEN,Accept-Encoding,X-Forwarded-For,X-Real-IP,X-Request-ID |  response header is used in response to a preflight request which includes the `Access-Control-Request-Headers` to indicate which HTTP headers can be used during the actual request. | \r\n| server.http.cors.exposed.headers | AAA_SERVER_HTTP_CORS_EXPOSED_HEADERS | * |  response header indicates which headers can be exposed as part of the response by listing their names. | \r\n| server.http.cors.optionpassthrough | AAA_SERVER_HTTP_CORS_OPTIONPASSTHROUGH | true | Indicates that the OPTIONS method should be handled by server | \r\n| server.http.cors.maxage | AAA_SERVER_HTTP_CORS_MAXAGE | 300 | response header indicates how long the results of a preflight request (that is the information contained in the `Access-Control-Allow-Methods` and `Access-Control-Allow-Headers` headers) can be cached | \r\n\r\n## API Doc\r\n\r\nAfter you have run the server, you can access the API Doc at\r\n\r\n[http://localhost:3000/docs/](http://localhost:3000/docs/)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhyperjumptech%2Fhansip","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhyperjumptech%2Fhansip","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhyperjumptech%2Fhansip/lists"}