Jump to content
  • Advertisement
Sign in to follow this  
  • entries
    25
  • comments
    26
  • views
    26426

Playing with authentication in Go

Liza Shulyayeva

935 views

It’s almost 2am and I’m sleepy, but I wanted to write this down while it’s relatively fresh in my mind.

I’ve been playing around with user authentication in Go.

While actual user interaction is not the primary part of the simulation and will not be the focus in the Go rewrite as I said in my previous post, there will need to be a few basic actions that a user will take before leaving the rest of the simulation to do its thing. This is why I mentioned implementing a very basic CLI to interact with the simulation earlier. The user will basically just need to sign up, log in, set some basic options for their snail stable (like the stable name and location), capture a snail or two, and leave them to do their thing from there. It is kind of like norn Wolfling runs in Creatures 3 - you have to hatch some norns before you let nature take its course.

Design differences from the PHP version

The main difference from the way the concept of users is currently implemented in the PHP version of SnailLife is this: users will no longer be considered synonymous with owners. In the PHP version of SnailLife, users and owners are just one table - account details, moderator/BrainHub management access fields, and stable information are all stored in one location. In my opinion this isn’t the best approach. A user of the snail simulation will not neccessarily need to be an owner of a stable or of any snails. This is especially true considering I’m building this thing with multiple possible applications in mind.

Approach

I haven’t worked much with authentication systems before - the PHP version of the app made use of the authentication features that came with Laravel. So this is largely going to be a matter of trial and error. The commit with the rough first stage of this can be found here. Here are the highlights:

  • For the Go rewrite I am thinking of using Auth0.
  • I suspect I may need different auth approaches for web and cli authentication, and my first thought is to separate these into plugins. I have added a client type enum to the Application struct that is populated on app init. If the application is of type CLI, the CLI authentication plugin will be loaded. If it is of type Web, the web authentication plugin will be loaded (but I am only implementing the CLI version for now).
  • The CLI plugin is built like this: go build -buildmode=plugin -o cli.so, and the authorizer then imports cli.so (or web.so, which is currently not built)
  • The plugin could potentially have multiple possible providers, but right now I am only implementing Auth0 - each provider is to implement the Provider interface defined outside of the plugin in the auth package.
  • I have added an auth.json to the conf directory (in gitignore of course), and also added a separate credentials generator for auth0 testing (also gitignored).
  • So far I have a registration and login test implemented - the test generates a random username (email) and password each run to test registration and login.
  • Authentication package structure is currently as follows:
auth
├── authenticator.go
├── auth.go
├── cli
│   ├── auth0
│   │   ├── auth0.go
│   │   └── tests
│   │       ├── auth0_test.go
│   │       └── config_test.go
│   ├── cli.go
│   └── cli.so
├── provider.go
└── web

 

 


0 Comments


Recommended Comments

There are no comments to display.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement
  • Advertisement
  • Blog Entries

  • Similar Content

    • By FredHicks
      I am finishing up my Game Programming and Design BS and am excited to start working in the field.  My biggest concern right now is that I live in a city with almost zero game studios and will be here for a while longer as me and my family have just bought our first house a couple years ago.  We do plan on moving in the future just for the purpose of change and experiencing something new and my girlfriend wants to move somewhere I can at least have opportunities to work in, but for now we are staying here while she finishes up her masters program.  What I am curious about is how to go about trying to get into the industry as a remote developer.  I am interested in any kind of work in the field to start off as I have been working on many different areas of game development since I was a kid in the early 90's but have finally decided to go for it in a serious way.  I guess I'm just looking for some advice and harsh reality checks about breaking into this highly competitive field as a remote developer.  I am new to the forums as well, so I hope I didn't break any rules I missed with this post.
      Thanks
    • By Tristanb4
      I've been making music for about 7 years, I have hundreds of releases on soundcloud and bandcamp. Recently I have stepped up my post production game, pouring long hours into EQ and mixing. Most of my music is in a moody, "foggy" piano style with heavy experimentation through pitch shifting, overdubbing, and live recording. I use a spectrogram EQ to manually shape sounds and scoop out noise in Audacity. I am familiar with many general concepts, applying compression, reverb, high and low pass filters, and pretty much all of the effects in Audacity and many of the pitfalls and lessons of live recording for guitar and piano in my home studio. I am familiar with some other programs like ableton and fruity loops but live recording is my strong suit as opposed to composing music in a DAW. I rely heavily on improvisation, recording large amounts of audio and cutting it down and manipulating it in post as well as doing overdubs. I can put out a project of piano music in a month or so up to what I think is a high / acceptable standard that I personally am happy with.

      I am heavily inspired by Akira Yamaoka's work on the Silent Hill series as well as Angelo Badalamenti. I dream of composing music for games or short films, and feel like I'm ready to take on a project like that, as well as being willing to license my already existing music out which I think would be a perfect fit for the right type of horror game or anything with emotional elements.

      I am currently working on another project that will be released in December or on New Years. I will work for a reasonable amount and have done this out of passion for 5+ years because I love doing it. I feel that I have improved enough now to pursue doing something like this.

      Thank you so much to anyone who even bothers to click any of these links, and thank you for your time!

      Here are my links, and you can also email me directly at tristan.best@gmail.com

      www.soundcloud.com/domonemesis
      https://tristanb.bandcamp.com/
      https://www.facebook.com/TristanBMusic
      https://twitter.com/tbest253


      Other skills: I do all of my own cover art with digital photo editing and subsequently also have about 5 years of experience with that- photography and digital photo manipulation. I can work on marketing materials or art in this way. I play the Piano, Guitar, Synth / String piano etc, and I sing. I have close connections to some other musicians and visual artists. I will be honest if I don't think my music will work for your project or if I'm not sure if I can do something well enough, but I feel comfortable taking on some general audio design as well, including general sound / dialogue recording or noise reduction.
    • By Zedr1k
      Hi everyone I’m currently learning programming and getting into the world of game developing.
      I set to myself the goal of trying to make a League of legends card game in unity, I already came with a few ideas but I’m still talking with friends and researching in different places which would be the best way to proceed with this project.
      I’m not really sure where is the place to post this but I’m looking for people who could help me, either by how could I put the “soul” of league into a card game if you know what league is about,how to make a card game that feels like a moba, any advice on the best way to develop a card game on unity, different mechanics that I should consider putting in the game, helping me find the right place to post this or Anything that you think could help me on this project.
      I will be more than thankful with anyone with the will to help me, sorry if you find any mistakes here, not a native speaker.
    • By ArcanaDragon
      This game is currently in alpha and all graphics are currently placeholder graphics. Any feedback is appreciated.
      Trailer: https://streamable.com/st2rr
      Game Link: https://arcanadragon.itch.io/hero-land
       
    • By Novakin
      Hi guys
      We have a few positions available for our Viking battle sim. It is a first/third person 3d game set in norway. We are looking for a concept artist and an assistant producer. We have a team of devs already and we are still in pre production but any devs can contact me and I may be able to offer additional positions for the right dev. This is a part time project. Anyone interested must be dedicated and motivated. For more info please contact me
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!