This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
0wiexpect(/should | |
hcE).to:s/==/eq/e | |
0j |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func authenticateBearer(c *echo.Context) error { | |
// Look for an Authorization header | |
if ah := c.Request().Header.Get("Authorization"); ah != "" { | |
// Should be a bearer token | |
if len(ah) > 6 && ah[0:6] == "Bearer" { | |
// Parse rest of header and verify with the secret | |
if token, err := jwt.Parse(ah[7:], tokenSecret); err == nil && token.Valid { | |
c.Set("token", token) | |
return nil |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'openssl' | |
require 'base64' | |
require 'uri' | |
require 'json' | |
require 'net/http' | |
require 'byebug' | |
username = 'username' | |
password = 'password' | |
service = 'NEXTAPI' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Formatter for just putting out the error message during runtime | |
# use with Rspec by --require <path_to_this_file> --formatter FailuresDuringRunFormatter | |
require 'spec/runner/formatter/progress_bar_formatter' | |
class FailuresDuringRunFormatter < Spec::Runner::Formatter::ProgressBarFormatter | |
def example_failed(example, counter, failure) | |
super #show the 'F' in progress | |
dump_failure(counter, failure) | |
end | |
end |