3/19/2024 0 Comments Google authenticator totp javaLast Login Time Attribute: User attribute, where users last login time in UNIX format is stored. OATH Algorithm to Use: For Google Authenticator should be TOTP. Secret Key Attribute Name: User attribute in where a secret key is stored.One Time Password Length: Should be 6 as in Google Authenticator by default.Login into admin console as amadmin user, go to realm staff, and create new OATH module google-authenticator with the following settings: OpenAM Setup Setup Authentication Moduleįor example, we have realm staff where we want to set up 2FA with Google Authenticator. In the following article, we will describe how to set up 2FA in OpenAM with Google Authenticator. Google Authenticator is one of the most commonly used applications for two-factor authentication (2FA). How to Setup 2FA with Google Authenticator in OpenAM func sha1Hash ( msg : openArray ): seq = mapIt ( ( Sha1Digest ( secureHash ( msg ))), char ( it )) func `xor` ( s : seq val : byte ): seq = # Apply a XOR to the chars of a sequence. hash : HashFunc # Hash algorithm used with HMAC. baseTime : Time # The start time for TOTP step calculation. timeStep : Duration # Length of each time step for TOTP. Import endians, math, sequtils, std / sha1, times type HashFunc = proc ( msg : openArray ): seq OneTimePassword = object digit : int # Length of code generated. ) end for i in 1 : 7 println ( genotp ( "JBSWY3DPEHPK3PXP" )) sleep ( 15 ) end ) secret = transcode ( Base32Decoder (), secret32 ) return genotp ( secret kwargs. = 0 end return hashfunction ()]) end #see also hmac ( hashfunc, bs = 64 ) = ( key, msg, blocksize = bs ) -> hmac ( key, msg, hashfunc, blocksize ) function genotp ( secret :: String tokenlength = 6, hashfunc = hmac ( sha1 ), tim = time () / 30, outbase = 10 ) message = (()) msghash = hashfunc ( secret, message ) offset = msghash & 0x0f binary = ( Int ( msghash & 0x7f ) << 24 ) | ( Int ( msghash & 0xff ) << 16 ) | ( Int ( msghash & 0xff ) << 8 ) | ( msghash & 0xff ) otp = binary % outbase ^ tokenlength string ( otp, pad = tokenlength, base = outbase ) end function genopt_fromb32 ( secret32 kwargs. Using CodecBase using SHA function hmac ( key, msg, hashfunction, blocksize = 64 ) key = hashfunction ( key ) paddingneeded = blocksize - length ( key ) if paddingneeded > 0 resize! ( key, blocksize ) key. Using System using namespace RosettaTOTP Microsoft Authenticator App (Windows Phone).Google Authenticator App (Google Android).It also expects the K secret key to be entered (or supplied in a QR code) in base-32 encoding according to RFC 3548.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |