-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #344 from ComPlat/development
Development - reporting tools upg - molecule_name upd on sample change - disable data collector job - fix bug on collection destroy and better test coverage - BE json import-export upg
- Loading branch information
Showing
115 changed files
with
3,488 additions
and
2,135 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,29 @@ | ||
class TokenAuthentication | ||
attr_reader :request | ||
attr_reader :request, :args, :key, :token | ||
|
||
def initialize(request) | ||
def initialize(request, **args) | ||
@request = request | ||
@args = args | ||
@token = request.headers['Authorization']&.match( | ||
/^Bearer\s*([\w\-\.\~\+\/]+)=*/) && $1 | ||
@key = AuthenticationKey.find_by(token: token) | ||
end | ||
|
||
def is_successful? | ||
token = request.headers['Auth-Token'] || request.params['auth_token'] | ||
API::AuthenticationKey.find_by(token: token).present? | ||
key && all_checks | ||
end | ||
|
||
def all_checks | ||
check_keys.map{|check| send(check) }.all? | ||
end | ||
|
||
private | ||
|
||
def check_keys | ||
args.keys & [:with_remote_addr] | ||
end | ||
|
||
def with_remote_addr | ||
key && key.ip.include?(request.env['REMOTE_ADDR']) | ||
end | ||
end |
This file was deleted.
Oops, something went wrong.
Binary file not shown.
Oops, something went wrong.