Skip to content
Snippets Groups Projects
Commit f075c1fc authored by Pavan Vachhani's avatar Pavan Vachhani :hotsprings:
Browse files

Added: IRIS OAuth basic profile scope

parents
No related branches found
No related tags found
No related merge requests found
/.bundle/
/.yardoc
/_yardoc/
/coverage/
/doc/
/pkg/
/spec/reports/
/tmp/
<component name="ProjectDictionaryState">
<dictionary name="pavan">
<words>
<w>omniauth</w>
</words>
</dictionary>
</component>
\ No newline at end of file
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="Rubocop" enabled="false" level="WARNING" enabled_by_default="false" />
</profile>
</component>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="JavaScriptSettings">
<option name="languageLevel" value="ES6" />
</component>
<component name="ProjectRootManager" version="2" project-jdk-name="RVM: ruby-2.6.3 [global]" project-jdk-type="RUBY_SDK" />
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/omniauth-iris.iml" filepath="$PROJECT_DIR$/.idea/omniauth-iris.iml" />
</modules>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<module type="RUBY_MODULE" version="4">
<component name="ModuleRunConfigurationManager">
<shared />
</component>
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/features" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/spec" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/test" isTestSource="true" />
</content>
<orderEntry type="jdk" jdkName="RVM: ruby-2.6.3" jdkType="RUBY_SDK" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" scope="PROVIDED" name="bundler (v2.0.2, RVM: ruby-2.6.3) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="rack (v2.0.7, RVM: ruby-2.6.3) [gem]" level="application" />
</component>
</module>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ChangeListManager">
<list default="true" id="97e2f644-fac5-4d81-9b38-19ac3078023c" name="Default Changelist" comment="">
<change afterPath="$PROJECT_DIR$/.gitignore" afterDir="false" />
<change afterPath="$PROJECT_DIR$/CODE_OF_CONDUCT.md" afterDir="false" />
<change afterPath="$PROJECT_DIR$/Gemfile" afterDir="false" />
<change afterPath="$PROJECT_DIR$/LICENSE.txt" afterDir="false" />
<change afterPath="$PROJECT_DIR$/README.md" afterDir="false" />
<change afterPath="$PROJECT_DIR$/Rakefile" afterDir="false" />
<change afterPath="$PROJECT_DIR$/omniauth-iris.gemspec" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
<option name="LAST_RESOLUTION" value="IGNORE" />
</component>
<component name="Git.Settings">
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
</component>
<component name="ProjectId" id="1V1PXleydyUxiOmZa7i97x1embR" />
<component name="ProjectLevelVcsManager" settingsEditedManually="true" />
<component name="ProjectViewState">
<option name="hideEmptyMiddlePackages" value="true" />
<option name="showExcludedFiles" value="true" />
<option name="showLibraryContents" value="true" />
</component>
<component name="PropertiesComponent">
<property name="RunOnceActivity.ShowReadmeOnStart" value="true" />
<property name="WebServerToolWindowFactoryState" value="false" />
</component>
<component name="RecentsManager">
<key name="MoveFile.RECENT_KEYS">
<recent name="$PROJECT_DIR$/lib/omniauth" />
</key>
</component>
<component name="ServiceViewManager">
<option name="viewStates">
<list>
<serviceView>
<treeState>
<expand />
<select />
</treeState>
</serviceView>
</list>
</option>
</component>
<component name="SpringUtil" SPRING_PRE_LOADER_OPTION="true" RAKE_SPRING_PRE_LOADER_OPTION="true" RAILS_SPRING_PRE_LOADER_OPTION="true" />
<component name="SvnConfiguration">
<configuration />
</component>
<component name="TaskManager">
<task active="true" id="Default" summary="Default task">
<changelist id="97e2f644-fac5-4d81-9b38-19ac3078023c" name="Default Changelist" comment="" />
<created>1576417669994</created>
<option name="number" value="Default" />
<option name="presentableId" value="Default" />
<updated>1576417669994</updated>
<workItem from="1576417672139" duration="6756000" />
</task>
<servers />
</component>
<component name="TypeScriptGeneratedFilesManager">
<option name="version" value="1" />
</component>
<component name="WindowStateProjectService">
<state width="1816" height="280" key="GridCell.Tab.0.bottom" timestamp="1576424618914">
<screen x="58" y="27" width="1862" height="1053" />
</state>
<state width="1816" height="280" key="GridCell.Tab.0.bottom/58.27.1862.1053@58.27.1862.1053" timestamp="1576424618914" />
<state width="1816" height="280" key="GridCell.Tab.0.center" timestamp="1576424618913">
<screen x="58" y="27" width="1862" height="1053" />
</state>
<state width="1816" height="280" key="GridCell.Tab.0.center/58.27.1862.1053@58.27.1862.1053" timestamp="1576424618913" />
<state width="1816" height="280" key="GridCell.Tab.0.left" timestamp="1576424618913">
<screen x="58" y="27" width="1862" height="1053" />
</state>
<state width="1816" height="280" key="GridCell.Tab.0.left/58.27.1862.1053@58.27.1862.1053" timestamp="1576424618913" />
<state width="1816" height="280" key="GridCell.Tab.0.right" timestamp="1576424618914">
<screen x="58" y="27" width="1862" height="1053" />
</state>
<state width="1816" height="280" key="GridCell.Tab.0.right/58.27.1862.1053@58.27.1862.1053" timestamp="1576424618914" />
</component>
</project>
\ No newline at end of file
# Prefer Double quotes only
Style/StringLiterals:
EnforcedStyle: double_quotes
Enabled: true
Metrics/LineLength:
Max: 250
Naming/FileName:
Enabled: false
\ No newline at end of file
# Contributor Covenant Code of Conduct
## Our Pledge
In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to making participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, gender identity and expression, level of experience,
nationality, personal appearance, race, religion, or sexual identity and
orientation.
## Our Standards
Examples of behavior that contributes to creating a positive environment
include:
* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members
Examples of unacceptable behavior by participants include:
* The use of sexualized language or imagery and unwelcome sexual attention or
advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic
address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting
## Our Responsibilities
Project maintainers are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.
Project maintainers have the right and responsibility to remove, edit, or
reject comments, commits, code, wiki edits, issues, and other contributions
that are not aligned to this Code of Conduct, or to ban temporarily or
permanently any contributor for other behaviors that they deem inappropriate,
threatening, offensive, or harmful.
## Scope
This Code of Conduct applies both within project spaces and in public spaces
when an individual is representing the project or its community. Examples of
representing a project or community include using an official project e-mail
address, posting via an official social media account, or acting as an appointed
representative at an online or offline event. Representation of a project may be
further defined and clarified by project maintainers.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at vachhanihpavan@gmail.com. All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.
Further details of specific enforcement policies may be posted separately.
Project maintainers who do not follow or enforce the Code of Conduct in good
faith may face temporary or permanent repercussions as determined by other
members of the project's leadership.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
available at [http://contributor-covenant.org/version/1/4][version]
[homepage]: http://contributor-covenant.org
[version]: http://contributor-covenant.org/version/1/4/
Gemfile 0 → 100644
# frozen_string_literal: true
source "https://rubygems.org"
# Specify your gem's dependencies in omniauth-iris.gemspec
gemspec
group :development, :test do
gem "rake"
end
PATH
remote: .
specs:
omniauth-iris (1.0.0)
omniauth (~> 1.5)
omniauth-oauth2 (>= 1.4.0, < 2.0)
GEM
remote: https://rubygems.org/
specs:
faraday (0.17.1)
multipart-post (>= 1.2, < 3)
hashie (3.6.0)
jwt (2.2.1)
multi_json (1.14.1)
multi_xml (0.6.0)
multipart-post (2.1.1)
oauth2 (1.4.2)
faraday (>= 0.8, < 2.0)
jwt (>= 1.0, < 3.0)
multi_json (~> 1.3)
multi_xml (~> 0.5)
rack (>= 1.2, < 3)
omniauth (1.9.0)
hashie (>= 3.4.6, < 3.7.0)
rack (>= 1.6.2, < 3)
omniauth-oauth2 (1.6.0)
oauth2 (~> 1.1)
omniauth (~> 1.9)
rack (2.0.7)
rake (13.0.1)
PLATFORMS
ruby
DEPENDENCIES
bundler (~> 2.0)
omniauth-iris!
rake
BUNDLED WITH
2.0.2
The MIT License (MIT)
Copyright (c) 2019 Pavan Vachhani
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
# Omniauth::Iris
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/omniauth/iris`. To experiment with that code, run `bin/console` for an interactive prompt.
TODO: Delete this and the text above, and describe your gem
## Installation
Add this line to your application's Gemfile:
```ruby
gem 'omniauth-iris'
```
And then execute:
$ bundle
Or install it yourself as:
$ gem install omniauth-iris
## Usage
TODO: Write usage instructions here
## Development
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
## Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/omniauth-iris. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
## License
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
## Code of Conduct
Everyone interacting in the Omniauth::Iris project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/omniauth-iris/blob/master/CODE_OF_CONDUCT.md).
Rakefile 0 → 100644
# frozen_string_literal: true
require "bundler/gem_tasks"
require "rake/testtask"
Rake::TestTask.new(:test) do |t|
t.libs << "test"
t.libs << "lib"
t.test_files = FileList["test/**/*_test.rb"]
end
task default: :test
# frozen_string_literal: true
require "omniauth-iris/version"
require "omniauth/strategies/iris"
# frozen_string_literal: true
module OmniAuth
module Iris
VERSION = "1.0.0"
end
end
# frozen_string_literal: true
require "omniauth-oauth2"
module OmniAuth
module Strategies
# IRIS OAuth strategy class
class Iris < OmniAuth::Strategies::OAuth2
BASE_URL = "https://iris.nitk.ac.in"
AUTHENTICATION_PARAMETERS = %w[scope].freeze
option :name, "iris"
if OmniAuth.config.test_mode
option :client_options,
authorize_url: "http://localhost:3000/v1/oauth/authorize",
token_url: "http://localhost:3000/v1/oauth/token",
site: "http://localhost:3000"
else
option :client_options,
authorize_url: "#{BASE_URL}/v1/oauth/authorize",
token_url: "#{BASE_URL}/v1/oauth/token",
site: BASE_URL
end
def request_phase
super
end
def callback_phase
super
end
def authorize_params
super.tap do |params|
AUTHENTICATION_PARAMETERS.each do |v|
params[v.to_sym] = request.params[v] if request.params[v]
end
end
end
uid do
access_token.params["info"]["uuid"]
end
info do
access_token.params["info"]
end
def callback_url
full_host + script_name + callback_path
end
end
end
end
OmniAuth.config.add_camelization "iris", "iris"
# frozen_string_literal: true
require File.expand_path("lib/omniauth-iris/version", __dir__)
Gem::Specification.new do |spec|
spec.name = "omniauth-iris"
spec.authors = ["Pavan Vachhani"]
spec.email = ["vachhanihpavan@gmail.com"]
spec.summary = "Official OmniAuth strategy for IRIS"
spec.description = "Official OmniAuth strategy for IRIS"
spec.homepage = ""
spec.license = "MIT"
# Specify which files should be added to the gem when it is released.
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
spec.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
spec.files = `git ls-files`.split("\n")
spec.require_paths = ["lib"]
spec.version = OmniAuth::Iris::VERSION
spec.add_dependency "omniauth", "~> 1.5"
spec.add_dependency "omniauth-oauth2", ">= 1.4.0", "< 2.0"
spec.add_development_dependency "bundler", "~> 2.0"
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment