class Arkaan::OAuth::Application

An application is what is referred to in the OAuth2.0 RFC as a client, wanting to access private informations about the user. @author Vincent Courtois <courtois.vincent@outlook.com>

Public Instance Methods

redirect_uris_values() click to toggle source

Checks the URIs to get sure they are correct, a URI is correct if :

  • it is a string

  • it has a correct URL format.

# File lib/arkaan/oauth/application.rb, line 48
def redirect_uris_values
  regex = %r{\A(https?:\/\/)((([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)*)|(localhost:[0-9]{2,4})\/?)\z}
  redirect_uris.each do |uri|
    if !uri.is_a? String
      errors.add(:redirect_uris, 'type')
      break
    elsif uri.match(regex).nil?
      errors.add(:redirect_uris, 'format')
      break
    end
  end
end