Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

License

NotificationsYou must be signed in to change notification settings

Cisco-AMP/scim_engine

Repository files navigation

Build Status

Why ScimEngine Exists?

There's no general purpose SCIM SDK for Ruby on Rails. As a result,anyone implementing SCIM will need to take care of the SCIM schema andprotocol, which may take a significant overhead compared theimplementation of the actual APIs. This project aims to extract SCIMspecifics as a rails engine that can be plugged into a Ruby on Railsproject.

How to Use?

In your Gemfile, add:

gem 'scim_engine'

Mount this engine in config/routes:

namespace:scimdomountScimEngine::Engine=>'/'end

This will provide you with routes for ServerProviderConfig, Schemas,and ResourceTypes under/scim prefix.

You can decide which SCIM resources you want to support, and provideroutes / controllers accordingly. For example, to support theUserresource type, add the following to your routes:

namespace:scimdoget'Users/:id',to:'users#show',as::userpost'Users',to:'users#create'put'Users/:id',to:'users#update'delete'Users/:id',to:'users#destroy'mountScimEngine::Engine=>'/'end

Add your controller:

# app/controllers/scim/users_controller.rbmoduleScim# ScimEngine::ResourcesController uses a template method so that the# subclasses can provide the fillers with minimal effort solely focused on# application code leaving the SCIM protocol and schema specific code within the# engine.classUsersController <ScimEngine::ResourcesControllerdefshowsuperdo |user_id|user=find_user(user_id)user.to_scim(location:url_for(action::show,id:user_id))endenddefcreatesuper(resource_type, &method(:save))enddefupdatesuper(resource_type, &method(:save))enddefdestroysuperdo |user_id|user=find_user(user_id)user.deleteendendprotecteddefsave(scim_user,is_create:false)#convert the ScimEngine::Resources::User to your application object#and saverescueActiveRecord::RecordInvalid=>exception# Map the enternal errors to a ScimEngine errorraiseScimEngine::ResourceInvalidError.new()end# tell the base controller which resource you're handlingdefresource_typeScimEngine::Resources::Userenddeffind_user(user_id)# find your userendendend

To support customResource types, simply add a controller and providethe custom resource type via theresource_type method.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages


[8]ページ先頭

©2009-2025 Movatter.jp