-
Notifications
You must be signed in to change notification settings - Fork 269
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Extra attributes #163
Comments
I think we have something like that, please take a look here: also check other authenticators for extra_attributes. |
As I understand it, the feature provided is to give extra attributes from the backend but not fixed values. Consider the following case : The way to do that would be for rubycas-server to allow setting fixed attributes per-backend in the configuration: authenticator: authenticator: |
As for the second point, if one does this : extra_attributes: full_name The key of the extra attributes will be set to "full_name". If you use another authenticator that has another column/property for the full name, how can the service handle those attributes independently from the authenticator used? |
Just to clarify, because I am not sure if I understand what you trying to achieve. One CAS server for both organization (A and B). Is that correct? |
No, it is not really correct. Based on the example I gave in my last reply, The first authenticator sends out a fixed extra attribute of key "type" and value "internal". Then the services can determine whether to allow people or not. Remember, CAS is about authentication, not so much authorization. These attributes are static because they do not depend on the user; they are attached to the authenticator. Do you understand both of my requests now? |
hmm as I understand that it is exactly this what I mean.
and CAS will send back this id of authenticato which was used to the service. What do you think about this functionality it will solve all your issues? |
I think what you wan't can be easaly achiefed by yourself. You "only" have to create custom authenticators It can look like this (only dirty example) class MySQLAuth < CASServer::Authenticators::SQL
def extra_attributes
merged = @extra_attributes.dup
# fixed_attributes:
# - name: type
# value: internal
@options["fixed_attributes"].each do |int_attr|
key = int_attr["type"] # you need to change
value = int_attr["value"]
merged[key] = value
end
merged
end
end |
@mitfik What I described is an example scenario. But I'm sure there are other cases that could benefit from fixed attributes that your solution wouldn't satisfy. @slowjack2k That's an interesting idea. Why not implement something like that at the authenticator parent class? I think that's basically what I'm requesting actually :) |
I think your request with static attributes is very special in my opinion. I don't know how many user's would use this feature. So i think a custom adapter would be a better solution. But I missed your second feature request and there i think your right. It would be nice if not the application has to decide what's the name of an extra attribute. For instance with sql-adapter the extra attribute is company and I would extend Authenticators::Base def extra_attributes
if extra_attributes_mapping_needed?
mapped_extra_attributes(@extra_attributes)
else
@extra_attributes
end
end
def mapped_extra_attributes(attrs)
new_attrs ={}
#ToDo handle special attrs not mentionen in config file
@options[:extra_attributes].each do |old_name, mapped_name|
new_attrs[ mapped_name]=attrs[old_name]
end
new_attrs
end
def extra_attributes_mapping_needed?
@options[:extra_attributes].kind_of? Hash # or better use an option map_extra_attrs with true false
end
def extra_attributes_to_extract
if @options[:extra_attributes].kind_of? Array
attrs = @options[:extra_attributes]
if @options[:extra_attributes].kind_of? Hash
attrs = @options[:extra_attributes].keys
elsif @options[:extra_attributes].kind_of? String
attrs = @options[:extra_attributes].split(',').collect{|col| col.strip}
else
$LOG.error("Can't figure out attribute list from #{@options[:extra_attributes].inspect}. This must be an Array of column names or a comma-separated list.")
attrs = []
end
$LOG.debug("#{self.class.name} will try to extract the following extra_attributes: #{attrs.inspect}")
return attrs
end so it would be possible to define extra attributes this way extra_attributes:
name_in_the_adapter: name_the_app_needed |
It would be great if the implementation could provide a fixed extra attribute for an authenticator. It would be a way for services to know what kind of user it is depending on how it was authenticated.
Also, an extra attribute mapper would be welcome. With this feature, a service can get the good attribute even if SQL and LDAP have different "columns".
The text was updated successfully, but these errors were encountered: