Skip to content

Commit

Permalink
Some refactoring and enhancements
Browse files Browse the repository at this point in the history
Some refactoring and enhancements

Some refactoring and enhancements

Vital changes for Rails integration

1) Add validation tests (+ error class in order to pass)
2) Fixed login ticket lifetime bug (maximum_unused_login_ticket_lifetime was not used in login ticket validation)
3) Add remember_me functionality in the core
4) Change how service tickets are generated. Now each service tickets inherits from TicketGrantingTicket
in a way to imitate activerecord's belongs_to/has_many.
5) Other minor improvements
6) Tested with rubycas-server-rails engine

Fix exception for activerecord adapter

Add rake to gemfile

Remove duplicate gem

Add rspec to gemfile

method overloading in setup hash or file

Update README.md

Update to rspec 3.1, fix tests, add circleci

wip

Update to rspec 3.1, fix tests

add more specific gem versions

add ruby-version for circleci

update ruby version in circle.yml

remove .ruby-version file

Update README.md

Enhance adapter pattern

Extract memory adapter to another gem

Add basic adapter api

update version

relax rake and bundler dependencies

Remove in_memory adapter

wip

add rubycas-server-memory as test dependency in bundler

refactor module methods, fix tests

move module-based tickets generation api to Generations module

transform validations/generations to instance methods

fix tests

let instead of instance vars

minor changes

bump version

Update README.md

remove root dir method

fix tests

User masters gemfile

Add rubycas-server-memory to gemfile
  • Loading branch information
vasilakisfil committed Feb 2, 2015
1 parent ea7e7a6 commit 1cd26ca
Show file tree
Hide file tree
Showing 26 changed files with 514 additions and 400 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
*.gem
*.rbc
log
.bundle
.config
.yardoc
Expand All @@ -16,3 +17,4 @@ test/tmp
test/version_tmp
tmp
*.DS_Store
*.db
1 change: 0 additions & 1 deletion .ruby-gemset

This file was deleted.

1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,5 @@ end
group :test do
gem 'rake'
gem 'rspec'
gem 'rubycas-server-memory', github: 'vasilakisfil/rubycas-server-memory'
end
51 changes: 49 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,60 @@
rubycas-server-core
===================
[![Build Status](https://travis-ci.org/rubycas/rubycas-server-core.png)](https://travis-ci.org/rubycas/rubycas-server-core)
The core logic for handling CAS requests independent of any particular storage or web presentation technology.
[![Circle CI](https://circleci.com/gh/vasilakisfil/rubycas-server-core.svg?style=svg)](https://circleci.com/gh/vasilakisfil/rubycas-server-core)

The core logic for handling CAS requests independent of any particular storage or web presentation technology.

## Requirements

* ruby 2.1.x

## Adapters
Currently available adapters are:
* [rubycas-server-activerecord](https://github.com/kollegorna/rubycas-server-activerecord)
* [rubycas-server-memory](https://github.com/vasilakisfil/rubycas-server-memory)

If you want to create a new adapter check these 2 adapters how they are implemented. Essentially you need to implement the following methods for each ticket:

```ruby

class XXXTicket
def initialize(options = {})
end

#deprecated
def self.find_by_ticket(ticket)
#returns the ticket based on the ticket id
#it will be removed soon
end

def self.find_by(opts = {})
#returns the ticket based on the constraints in the hash (activerecord-style)
end

def save!
#saves the ticket in the storage
#throws an exception in case of an error
end

def save
#saves the ticket in the storage
end

def consumed?
#returns true if ticket is already consumed
end

def consume!
#consumes the ticket
end

def expired?(max_lifetime = 100)
#checks if the ticket is already expired
end

end
```

## Contributing

1. Fork it
Expand Down
3 changes: 3 additions & 0 deletions circle.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
machine:
ruby:
version: 2.1.2
4 changes: 3 additions & 1 deletion lib/rubycas-server-core.rb
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
require "logger"
require "r18n-core"
require "rubycas-server-core/version"
require "rubycas-server-core/error"
require "rubycas-server-core/authenticator"
require "rubycas-server-core/settings"
require "rubycas-server-core/database"
require "rubycas-server-core/util"
require "rubycas-server-core/tickets"
require "rubycas-server-core/tickets/generations"
require "rubycas-server-core/tickets/validations"
require "rubycas-server-core/tickets"

module RubyCAS
module Server
Expand Down
21 changes: 0 additions & 21 deletions lib/rubycas-server-core/adapters/in_memory.rb

This file was deleted.

45 changes: 0 additions & 45 deletions lib/rubycas-server-core/adapters/in_memory/login_ticket.rb

This file was deleted.

This file was deleted.

50 changes: 0 additions & 50 deletions lib/rubycas-server-core/adapters/in_memory/proxy_ticket.rb

This file was deleted.

56 changes: 0 additions & 56 deletions lib/rubycas-server-core/adapters/in_memory/service_ticket.rb

This file was deleted.

23 changes: 0 additions & 23 deletions lib/rubycas-server-core/adapters/in_memory/storage.rb

This file was deleted.

This file was deleted.

2 changes: 1 addition & 1 deletion lib/rubycas-server-core/database.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module Core
module Database
extend self
def setup(config_file)
raise NotImplementedError, "Database adapter is missing, add it to your Gemfile, please refer to https://github.com/rubycas/rubycas-server-core/wiki for more details"
#raise NotImplementedError, "Database adapter is missing, add it to your Gemfile, please refer to https://github.com/rubycas/rubycas-server-core/wiki for more details"
end
end
end
Expand Down
Loading

0 comments on commit 1cd26ca

Please sign in to comment.