반응형
블로그 이미지
개발자로서 현장에서 일하면서 새로 접하는 기술들이나 알게된 정보 등을 정리하기 위한 블로그입니다. 운 좋게 미국에서 큰 회사들의 프로젝트에서 컬설턴트로 일하고 있어서 새로운 기술들을 접할 기회가 많이 있습니다. 미국의 IT 프로젝트에서 사용되는 툴들에 대해 많은 분들과 정보를 공유하고 싶습니다.
솔웅

최근에 올라온 글

최근에 달린 댓글

최근에 받은 트랙백

글 보관함

카테고리

Kurogo Tutorial 24 - People Module -

2012. 10. 10. 21:23 | Posted by 솔웅


반응형

People Module



people 모듈은 directory 로 어떤 mobile access 기능을 제공하는 겁니다. 간단한 configuration으로 모바일 device 에서 유저에 대한 searching 과 detail 한 정보 보기 등을 가능하도록 할 수 있습니다. LDAP base directory와 database backed directories 모두 지원합니다.


Configuring the Server Connection



이 모듈의 configuration은 Administration Module 이나 SITE_DIR/config/people/feeds.ini file을 edit 하셔야 합니다. 여러분의 directory 시스템에 connect 하기 위해서는 여러 방법들이 사용될 수 있습니다.


  • RETRIEVER_CLASS allows you to determine the mechanism for retrieving the data. Current options include:
    • LDAPPeopleRetriever - uses a standard LDAP server. You can configure the various fields if your values differ from defaults
    • ADPeopleRetriever - a subclass of the LDAP retriever that has preconfigured mappings for Active Directory
    • DatabasePeopleRetriever - connects to an external database server. This controller assumes that people are mapped to a single row and that the various fields are stored in single (definable) columns
  • PERSON_CLASS allows you to set a different class name for the returned user objects when searching. This class must be a subclass of the Person class. This allows you to write custom behavior to handle the data in your directory service.


Options for LDAPPeopleRetriever and ADPeopleRetriever


  • HOST - should match the address of your server. Keep in mind that this server must be accessible from the web server the framework is hosted on. Managing network and firewall settings is the responsibility of your network administrator.
  • SEARCH_BASE - should manage the LDAP search base of your directory. You can get this value from the administrator of your LDAP directory. Examples would include “dc=example,dc=com”
  • PORT - Optional (Default 389) The port to connect. Use 636 for SSL connections (recommended if available)
  • ADMIN_DN - Some servers do not permit anonymous queries. If necessary you will need to provide a full distinguished name for an account that has access to the directory. For security this account should only have read access and be limited to the search bases to which it needs to access.
  • ADMIN_PASSWORD - The password for the ADMIN_DN account.





다음 값들은 controller에게 searching 할 때 어떤 attributes들을 사용할 것인지를 알려 줍니다. 이 값들은 디폴트값고 다를 경우 사용할 필요가 있을 겁니다.


  • LDAP_USERID_FIELD (uid, samaccountname for AD)- Stores the unique user name for this user. Do not choose an attribute that is sensitive as they are easily viewed by users
  • LDAP_EMAIL_FIELD (mail) - The attribute of the user’s email address
  • LDAP_FIRSTNAME_FIELD (givenname) - The attribute of the user’s first name
  • LDAP_LASTNAME_FIELD (sn) - The attribute of the user’s last name
  • LDAP_FULLNAME_FIELD (blank) - If you wish to use a single field for name (like cn), include this here.
  • LDAP_PHONE_FIELD (telephonenumber) - The attribute of the user’s phone number

Options for DatabasePeopleRetriever


DatabasePeopleRetriever 에는 사용할 수 있는 여러 configuration value들이 있습니다. 모두 optional 이죠. 데이터베이스 connection에 대한 configuration에 대해 자세히 알고 싶으시면 Database Access를 보세요.

만약 이중에 어떤 value 라도 생략되면은 디폴트를 세팅할 겁니다. (Configuring Database Connections)

아래 value는 데이터가 있는 테이블의 위치를 controller에게 알려 줍니다.


  • DB_USER_TABLE - (users) The name of the table that stores the user records. This table should at least have fields for userID, name and email. Each row should contain a single user entry.


아래 값들은 controller 에게 주요 field 에 대한 정보를 줍니다. 이 값들은 디폴트값과 그 값이 다를 경우에 적용되게 됩니다.


  • DB_USERID_FIELD (userID)- stores the userID in the user table. You can use any unique column for the userID field. Do not use sensitive values as they are easily viewed by users.
  • DB_EMAIL_FIELD (email) - stores the email in the user table
  • DB_FIRSTNAME_FIELD (firstname) - stores the first name of user.
  • DB_LASTNAME_FIELD (firstname) - stores the last name of user.
  • DB_PHONE_FIELD (no default) - stores the user’s phone number. If empty then the search will not use the phone number


다른 필드들은 아래 configuring the detail fields 에서 설명됩니다.


Configuring the Detail Fields


서버 세팅이 끝났으면 여러분 서버와 detail view 와의 field mapping을 해야 합니다. 디폴트로는 LDAP으로 세팅 돼 있습니다. 만약에 nonstandard directory를 사용하신다면 혹은 자체 필드들을 가지고 있는 데이터베이스와 연결하신다면 이것들이 어떻게 display 될지에 대해 customize 하셔야 합니다.

이 필드들은 SITE_DIR/config/people/page-detail.ini file 에 configured 됩니다. 각 필드는 섹션별로 configured 됩니다. (섹션 이름은 unique 해야 합니다.) 섹션의 순서는 detail view의 순서와 같습니다. 각 섹션안에는 어떻게 display 될지에 대해 설정할 수 있는 여러 value들을 넣을 수 있습니다.


  • label - (required) A text label for the field. Can include HTML tags.
  • attributes - (required) Array of fields to put in the contents (should map the the field names in your backend system)
  • format - (optional) A string for vsprintf to format the attributes. Only needed if more than one attribute is provided.
  • type - (optional) One of “email” or “phone”. Used to format and generate links.
  • module - (optional) Creates a link to a another module and uses that module’s linkForValue method to format the result. See the section on Module Interaction for more details.
  • section - (optional) If this field belongs to a section, the name of that section
  • parse - (optional) A function which will be run on the value before display. Generated with create_function. Gets the argument “$value” and returns the formatted output.


Configuring Display Options


아래 있는 옵션들은 people 모듈을 appearence 하는데 관련된 것들입니다.

  • BOOKMARKS_ENABLED - (optional) If set to true, a link to bookmarked entries will appear. Note that if you have not bookmarked any entries, this link will not appear until an entry is bookmarked. Defaults to true.
  • CONTACTS_SUBTITLE_NEWLINE - (optional) Set to true to display contacts subtitles on a new line. Defaults to false.
  • SEARCH_TIP - (optional) A string to be shown near the search bar providing a tip about searching. By default this string is empty, and not shown.


Configuring the Fixed Entries


이 모듈은 모듈 인덱스 페이지에서 directory entry들의 리스트를 보이게 할 수 있습니다. 그리고 SITE_DIR/config/people/contacts.ini를 수정함으로서 이 리스트의 content를 update 하실 수 있습니다. 각 entry는 섹션의 0-indexed 형식으로 숫자화 되서 다뤄집니다. 각 섹션은 4개의 value들이 있습니다. 이것들은 listItem template 과 매핑돼 있죠. 이것들은 URL 리스트를 표시하기 때문에 phone number 를 가지지 못합니다. 다만 어떤 URL 이라도 올 수 있습니다.


  • title - The Name of the entry as it’s shown to the user
  • subtitle - The subtitle, typically the phone number for phone entries.
  • url - The link it should point to, use tel:XXXXXXXX links for phone numbers
  • class - The CSS class of the item, such as phone, map, email


Creating groups of contacts

  • NOTE - Creation of contact groups is not supported in the admin console at this time.


만약에 여러 contacts 를 카테고리로 묶어야 한다면 여러분들은 그것을 group으로 묶어야 합니다. contact group들을 만드시려면 아래와 같이 하시면 됩니다.


  1. If it does not exist, create a file named SITE_DIR/config/people/contacts-groups.ini
  2. Add a section to contacts-groups.ini with a short name of your group. This should be a lowercase alpha numeric value without spaces or special characters
  3. This section should contain a “title” option that represents the title of the group. Optionally you can include a description value that will show at the top of the contacts list for the group
  4. Create a file named SITE_DIR/config/people/contacts-groupname.ini where groupname is the short name of the group you created in contacts-groups.ini. This file should be formatted like contacts.ini with each entry being a numerically indexed section
  5. To use this group, assign it to a entry in contacts.ini. Do not include a url, but rather add a value group with a value of the short name of the group. You can optionally add a title that will be used instead of the group title indicated in contacts-groups.ini


아래는 SITE_DIR/config/people/contacts-groups.ini의 예제입니다. 각 그룹은 섹션으로 표현되는데 그 안에는 title 이 있고 옵션으로 description 이 있습니다. 여러분이 원하는 만큼의 그룹을 만드실 수 있습니다.


[admissions]
title = "Admissions"


SITE_DIR/config/people/contacts-admissions.ini. 아래는 admissions group의 예제입니다. contacts.ini file과 같은 형식입니다.


[0]
title    = "Admissions Main Number"
subtitle = "(617-555-0001)"
url      = "tel:6175550001"
class    = "phone"

[1]
title    = "Admissions Hotline"
subtitle = "(617-555-0002)"
url      = "tel:6175550002"
class    = "phone"


SITE_DIR/config/people/contacts.ini. 그룹을 보이기 위해 group value가 있습니다. url value는 없습니다.


[0]
title    = "Static Entry 1"
subtitle = "(617-555-0001)"
url      = "tel:6175550001"
class    = "phone"

[1]
title    = "Admissions"
group    = "admissions"


반응형

Kurogo Tutorial 23 - Links Module -

2012. 10. 10. 03:43 | Posted by 솔웅


반응형



========= o ============ o ========== o ========== o ================


이 부분은 Tutorial 이 잘 못 되었네요.


Links 모듈 설명하다가 갑자기 People 모듈로 건너 뛰었습니다.

저 위에 이미지 다음 부터는 people 모듈 관련 내용입니다.


Kurogo 쪽에 얘기해야겠어요... ^^;

반응형

Kurogo Tutorial 22 - Content Module -

2012. 10. 10. 01:44 | Posted by 솔웅


반응형

Content Module


content module은 다른 소스로부터 자유롭게 content를 모으고 display 할 목적으로 만들어 졌습니다. Content Module은 다른 HTML site 나 RSS feed 로부터 display 된 곳으로부터 content를 모아서 display 할 수 있습니다. 또한 configuration file이나 administration module을 사용해서 static content configured 를 display 하도록 할 수 있습니다.

디폴트로 content 모듈은 리스트에 그 feed 를 display 합니다. 그리고 나서 유저가 feed를 선택하면 그 feed 의 content가 보여지게 되는 겁니다. 만약에 feed 가 1개만 있다면 리스트 대신 그 feed 가 보여집니다. 옵션으로 group화 할 수 있습니다.


Configuring Content Feeds


SITE_DIR/config/MODULE/feeds.ini file에 원하는 만큼의 feed 를 정의 하세요. 각 feed 는 section에 의해 표현됩니다. 그 섹션의 이름은 모듈의 page를 의미합니다. 이곳에는 configure 할 몇가지 property들이 있습니다.


  • TITLE - The title of the feed. This is shown in the list and in the navigation bar
  • CONTENT_TYPE - the type of content. Values include:
    • html - Static html text that is included in the CONTENT_HTML property
    • html_url - Fetch HTML content from the BASE_URL property.
    • rss - Fetch RSS content from the BASE_URL property. Will retrieve the content from the first item in the feed. Good for CMS’s that expose their content via RSS. Ensure that this feed contains the full content and not just a link



Creating Groups of Content


  • NOTE - Creation of content groups is not supported in the admin console at this time.

You can create groups of content in order to organize similar content into categories. Creating content groups involves the following steps:

유사한 콘텐트를 하나의 카테고리에 묶기 위해 콘텐트의 group을 만들 수 있습니다. 아래와 같이 group을 생성하시면 됩니다.

  1. SITE_DIR/config/MODULE/feedgroups.ini 파일을 생성한다.
  2. 그룹 이름을 feedgroups.ini 의 section 안에 넣는다. 스페이스나 특수문자가 없는 alpha numeric 소문자이어야 한다.
  3. 섹션에는 TITLE option이 있어야 한다. 이것은 그룹의 title을 나타낸다. 옵션으로 DESCRIPTION value를 넣을 수 있다. 이것은 그룹의 리스트 top에 보여질 내용이다.
  4.  SITE_DIR/config/MODULE/feeds-groupname.ini  파일을 만든다. groupname is the short name of the group you created in feedgroups.ini. This file should be formatted like feeds.ini with each entry being a uniquely indexed section.
  5. 이 그룹을 사용하기 위해 eeds.ini. 안에 entry를 할당한다. 그룹의 short name 값으로 GROUP 값을 넣는다. 옵션으로 TITLE을 넣을 수 있다. 이것은 eedgroups.ini 안에서 group title 대신에 쓰이게 된다.

feeds.ini file에는 groups와 content entry 들이 있을 겁니다. 이것들은 section의 순서대로 display 될 겁니다. 만약 1개의 그룹만이 있다면 그 그룹이 display 될 겁니다.

아래는 SITE_DIR/config/MODULE/feedgroups.ini 예제입니다. 각 그룹은 TITLE이 있는 section 입니다. 여러분이 원하는 만큼의 그룹을 만들 수 있습니다.


[applying]
TITLE = "Applying to Universitas"
DESCRIPTION = ""

[visiting]
TITLE = "Visiting"
DESCRIPTION = ""


SITE_DIR/config/MODULE/feeds-applying.ini.  아래는 applying group 예제입니다. feeds.ini file처럼 format 됐습니다.


[admissions]
TITLE = "Admissions"
SUBTITLE = ""
SHOW_TITLE = 0
CONTENT_TYPE = "html_url"
BASE_URL = "http://universitas.modolabs.com/admissions"
HTML_ID = "node-2"


SITE_DIR/config/MODULE/feeds.ini


[applying]
TITLE = "Applying to Universitas"
GROUP = "applying"

[visiting]
TITLE = "Visiting"
GROUP = "visiting"

[othercontent]
TITLE = "Other Content"
SUBTITLE = ""
SHOW_TITLE = 0
CONTENT_TYPE = "html_url"
BASE_URL = "http://www.example.com/othercontent"
HTML_ID = "html-id"


Options for HTML Content


HTML document에서 data를 추출하기 위해서는 몇가지 옵션이 추가로 있습니다. 대부분의 경우 HTML, HEAD 태그 같은 것들은 건너뛰고 header와 footer 들도 remove 할 겁니다. 그리고 그 HTML 문서의 일부분만 사용하길 원하겠죠. 어떤 content 를 포함 시킬것인지 결정하는 방법에는 두가지가 있습니다.

  • HTML_ID - Use this option to include only a single element (and its child elements) based on its HTML id attribute. This is the simplest, and most recommended option if it is available. The value for this option is case sensitive.
  • HTML_TAG - Use this to include all elements of a certain tag. For instance set it to “table” to include all table elements or “p” to include all paragraph elements. Do not include the surrounding brackets (<, >)


만약 이 옵션을 사용하지 않으면 body tag 전체가 추출될 겁니다.


반응형

Database Authentication

2012. 9. 12. 21:01 | Posted by 솔웅


반응형

Database Authentication


DatabaseAuthentication 클래스는 열결된 데이터베이스에 있는 authentication과 user/group 정보를 제공합니다. 데이터베이스는 main configuration file에 셋업된 디폴트 데이터베이스를 사용할 수도 있고 그 자체의 credential과 세팅을 가지고 있는 별도의 시스템을 사용할 수도 있습니다. 여러분은 이 authentication data를 찾는데 사용되는 테이블을 customize 할 수 있습니다. 그리고 비밀전호 hash를 위한 알고리즘을 지정할 수도 있습니다. authority도 최소한의 configuration으로 새로운 series of table들을 쉽게 셋업할 수 있도록 디폴트 세팅 세트를 제공합니다.


Note : 현재 이 authority에서는 유저나 그룹을 생성하거나 관리하는 기능을 제공하지는 않습니다. 이 글은 여러분이 이미 만들어진 시스템에 연결하는 상황 그리고 여러분이 유저와 그룹을 관리하는 상황을 가정하고 작성되었습니다.




Configuration


DatabaseAuthentication authority는 여러 configuration value들을 가지고 있습니다. 모두 optional 입니다. 아래 value들이 데이터베이스에 연결하는데 영향을 미치는 것들입니다.

  • DB_TYPE - database system은 PDO를 통해 mysql과 sqlite를 지원합니다. 
  • DB_HOST - used by db systems that are hosted on a server
  • DB_USER - used by db systems that require a user to authenticate
  • DB_PASS - used by db systems that require a password
  • DB_DBNAME - used by db systems that require a database
  • DB_FILE - used by db systems the use a file (i.e. sqlite).


위 값들 중 빠진 값들은 SITE_DIR/config/site.ini에서 connectivity settings 을 가져와서 디폴트로 사용할 겁니다. 데이터베이스에 query를 어떻게 할지에 대한 여러 옵션들이 있습니다. 이 때 유저와 그룹 모두를 사용할 필요는 없습니다. 한가지만 필요하면 그걸 사용하시면 됩니다.


아래 값들은 데이터가 위치한 데이터베이스 테이블의 authority를 나타냅니다 :


  • DB_USER_TABLE - (users) The name of the table that stores the user records. This table should at least have fields for userID, password and email. It can also have fields for first/last name or full name. Each row should contain a single user entry
  • DB_GROUP_TABLE (groups) The name of the table that stores group information. It should have fields for shortname and group id. Each row should contain a single group entry.
  • DB_GROUPMEMBERS_TABLE - (groupmembers) The name of the table that stores the members of each group, it should have a field for the group name/id and the userID of the user. Each row should contain an entry that contains the group name and userID. The system will search for members that match the group name.


아래 값들은 어떤 필드들을 사용할지에 대해 authority에 알려 줍니다. :


  • DB_USER_USERID_FIELD (userID)- stores the userID in the user table. For systems that use the email address as the key, you should include the email field
  • DB_USER_PASSWORD_FIELD (password) -stores a hashed value of the user’s password. See DB_USER_PASSWORD_HASH for possible hashing algorithms (Default is md5)
  • DB_USER_EMAIL_FIELD (email) - stores the email in the user table
  • DB_USER_FIRSTNAME_FIELD (empty) - stores the first name of user. Won’t be used unless it is specified
  • DB_USER_LASTNAME_FIELD (empty) - stores the last name of user. Won’t be used unless it is specified
  • DB_USER_FULLNAME_FIELD (empty) - stores the full name of user. Won’t be used unless it is specified
  • DB_GROUP_GROUPNAME_FIELD (group) - stores the short name of the group in the group table
  • DB_GROUP_GID_FIELD - (gid) - stores the group id of the group in the group table. Should be numerical
  • DB_GROUPMEMBER_GROUP_FIELD (gid) - which field to use when looking up groups in the group member table. This is typically the same value as the group name or gid field
  • DB_GROUPMEMBER_USER_FIELD (userID) - which field to use when looking up user in the group member table. This is typically either the userID or the email
  • DB_GROUPMEMBER_AUTHORITY_FIELD - If present you can store the authority index in this field. This allows the system to map group members to other authorities.


다른 값들은 어떻게 그룹 멤버쉽이 키가 되는지를 알려줍니다.


  • DB_GROUP_GROUPMEMBER_PROPERTY - (gid) - This is not stored in the database, but refers to which field will be used to look up group information in the group member table. Valid values are gid or group (i.e. the shortname) gid is the default.


암호 해싱 방법과 관련한 값들도 있습니다.


  • DB_USER_PASSWORD_HASH (md5) - This is a string that represents a valid hashing function. It indicates what

    hashing algorithm is used to store the password. See hash_algos() for a list of valid hashing algorithms. Keep in mind that available algorithms may differ by PHP version and platform. You can also use the hmac_ prefix to use the hmac signing method (i.e. hmac_sha1). This requires setting the DB_USER_PASSWORD_KEY value.

  • DB_USER_PASSWORD_KEY (empty) - Necessary if you use the more secure hmac variant hashing algorithms. This uses a shared key to sign the value using hash_hmac

  • DB_USER_PASSWORD_SALT_BEFORE (empty) - If present this string will be prepended to any string as a salt value before hashing. This is useful if you are using fixed salts.

  • DB_USER_PASSWORD_SALT_AFTER (empty) - If present this string will be appended to any string as a salt value before hashing. This is useful if you are using fixed salts.

  • DB_USER_PASSWORD_SALT_FIELD_BEFORE (empty) - If present the value of this field for the user will be prepended to any string as a salt value before hashing. This is useful if you are using variable salts.

  • DB_USER_PASSWORD_SALT_FIELD_AFTER (empty) - If present the value of this field for the user will be appended to any string as a salt value before hashing. This is useful if you are using variable salts.


How it Works


User Authentication


USER_LOGIN을 FORM으로 해서 user authentication 을 지원한다면 authority는 USER_TABLE을 볼겁니다. 그리고 타입된 값과 맞는 DB_USER_USERID_FIELDDB_USER_EMAIL_FIELD 의 레코드 값을 찾을 겁니다. 해당 record를 찾으면 DB_USER_USERID_FIELD에 있는 값이 type 된 패스워드의 hashed 값과 매치 되는 지를 볼 거구요. (이때 DB_USER_PASSWORD_HASH algorithm을 사용합니다.) 데이터베이스에서 사용한 해쉬 알고리즘과 configuration에서 지정한 해쉬 알고리즘이 동일해야 합니다.


User Lookup


Users는 DB_USER_TABLE를 살피고 요청된 값과 DB_USER_USERID_FIELD or DB_USER_EMAIL_FIELD의 record 가 맞는지  봅니다. 만약에 맞는것을 찾으면 user object는 생성됩니다. 생성되는 것들은 값이 있는 경우 다음의 내용이 포함됩니다. B_USER_USERID_FIELD, DB_USER_EMAIL_FIELD and DB_USER_FIRSTNAME_FIELD,*DB_USER_LASTNAME_FIELD* and DB_USER_FULLNAME_FIELD


Group Lookup


Groups은 을 살피고 요청된 값과 DB_GROUP_GROUPNAME_FIELD or DB_GROUP_GID_FIELD의 record가 맞는지 봅니다. 만약에 맞는 것을 찾으면 group object가 생성됩니다. 생성되는 것들은 DB_GROUP_GROUPNAME_FIELD and DB_GROUP_GID_FIELD 값입니다.


Group Membership Lookup


Group membership은 DB_GROUPMEMBERS_TABLE안에서 query 됩니다. getMembers() 메소드는 DB_GROUPMEMBER_USER_FIELD를 사용해서 유저 객체 배열을 만듭니다.  DB_GROUPMEMBER_GROUP_FIELD 와 매치되는 모든 users는 return 됩니다. (DB_GROUP_GROUPMEMBER_PROPERTY,를 사용해서 리턴됩니다. 예:gid,short name) 그 user 객체들은 DB_GROUPMEMBER_AUTHORITY_FIELD에 의해 authority reference 되서 생성됩니다. 만약에 authority field 가 없으면 그룹과 같은 authority를 사용합니다. (예: DB_USER_TABLE를 사용할 겁니다.) 테이블의 다른 authority를 참조할 수 있습니다. (예: ldap users, google users 등)


Using Default Values


여러분의 reference database를 include 하고 싶으시면 아래와 같이 정의된 테이블의 모든 디폴트 값을 사용할 수 있습니다.



CREATE TABLE users (userID varchar(64), password varchar(32), email varchar(64),

firstname varchar(50), lastname varchar(50)); CREATE TABLE groups (`group` varchar(16), gid int); CREATE TABLE groupmembers (gid int, authority varchar(32), userID varchar(64));


이것은 디폴트 값들과 호환되는 테이블 구조입니다.


반응형

Authentication

2012. 9. 6. 21:08 | Posted by 솔웅


반응형

Authentication


특정 모듈에 대해서 검증된 유저만 (authenticated users) 접근이 가능하도록 할 필요가 있습니다. 또는 해당 유저에 알맞는 내용을 제공하거나 feedback에 참여하도록 허용할 수 있겠죠.


Kurogo 프레임워크는 authenticationg users와 내용에 대한 authorizing access 를 위한 기능을 제공하고 있습니다. 이런 기능을 위해서 유저별로 또는 특정한 그룹에 있는 멤버에게만 접근이나 관리의 권한을 주거나 제한하는 서비스를 제공할 수 있습니다.


Kurogo는 기존에 존재하는 identity 시스템과 같이 사용하실 수도 있습니다. 예를 들어 Active Directory, MySQL databases, Twitter, Facebook and Google 등이 있습니다.





Setting up Authentication


Authentication은 유저의 identity를 설립하는 프로세스입니다. 이 identity의 설립은 유저가 username과 password를 제공하면서 가능합니다. 프레임워크는 그 유저이름과 패스워드를 받아서 central authority를 통해서 credential을 test 하게 됩니다. 만약 authority가 credential에 적합하면 유저는 로그인 되고 관련된 서비스나 개인 정보를 사용할 수 있게 됩니다.



쿠로고 프레임워크에 의한 Authentication는 한개 이상의 authentication authorities를 통해서 제공 됩니다. 각 authority는 기존의 authentication system에 connect 하기 위해 configure 돼 있습니다. 여러분 사이트의 필요에 따라 여러분은 거기에 맞는 private self-hosted authentication system (like an LDAP/Active Directory or database system) or a public system (Twitter, Facebook, Google) 들을 사용하실 수 있습니다. 또한 standard authentication services (Google Apps) 같이 외부에서 제공되는 서비스를 사용해서 hybrid로 접근할 수도 있습니다. 간단하게 deploy 하려면 external service 필요없이 flat-file based system을 사용할 수도 있습니다.


각 authority는 아래와 같이 다양한 서비스를 제공할 수 있습니다.


  • User authentication - either through a direct login/password form or through an external system based on OpenID or OAuth
  • User attributes - At minimum authorities should supply id, name and email information. Some authorities can provide this information to any user in their system, however others can only provide this information on the logged in user
  • Group information and membership - Some authorities will also contain information on groups which allow you to logically organize users. Some authorities are designed to only contain users from their own domains, while others have the ability to utilize users from other authorities in their membership


이 모든 서비스를 다 제공할 필요는 없을 겁니다. 하나의 authority는 authentication과 information을 제공하고 다른 것은 group information을 제공하고 이렇게 여러 방법으로 사용될 수도 있습니다. 만약 여러분이 여러분의 authorization schemes에 group을 지정하지 않았다면 group information은 필요 없게 되겠죠.


Enabling Authentication


authenticating users를 지원하려면  SITE_DIR/config/site.ini 안에 있는 AUTHENTICATION_ENABLED 를 1로 세팅해야 합니다. 디폴트는 0 입니다.


Configuring Authorities


Authorities들은 SITE_DIR/config folder에 있는 authentication.ini file 에 정위 됩니다. 각 authority는 각 section에서 설정됩니다. 이 section 이름은 authority index로 사용되는 것이 좋습니다. 프레임워크에 의해 사용되는 programmatic value 죠. 이 value는 여러분이 원하는 대로 하셔도 됩니다. 다만 이전에 사용됐던 section을 중복해서 사용하지 않도록 주의하셔야 됩니다. 만약 중복 되면 문제가 생깁니다.


각 authority는 여러 attribute들이 필요합니다. 그리고 authority type에 따라 더 필요할 수도 있습니다. configuration file에 대한 좀 더 자세한 정보를 원하시면 Configuration를 참조하세요.


아래 내용들은 모든 authorities들에 필요한 값들입니다.


  • TITLE - This value is used when referencing the framework to users. If there is more than one authority available to users to choose the title will direct them to the correct one.
  • CONTROLLER_CLASS - This value should map to a valid subclass of AuthenticationAuthority. This defines the core behavior of the authority.
  • USER_LOGIN - There are 3 possible values:
    • FORM - Use the login form
    • LINK - Use a login link. The authority should handle this using their login method
    • NONE - This authority does not provide authentication services (i.e. just group services)


Included Authorities


Kurogo 프레임워크가 폭 넓은 세팅을 할 수 있도록 하기 위해 프로젝트는 몇가지 클래스들을 가지고 있습니다. 이 클래스들은 다양한 타입의 authentication과 authorization service들에 연결할 수 있도록 합니다.  각각은 나름대로 셋업하고 사용하기 위한 방법들이 있습니다. 아래 문서들을 잘 읽어보시고 개발하고 deploy 하기 위한 중요한 요구사항들을 잘 살펴 보시기 바랍니다.



반응형

Flat File Authentication

2012. 9. 6. 08:59 | Posted by 솔웅


반응형

Flat File Authentication


PasswdAuthentication
class는 로컬에 있는 flat file의 authentication과 user/group 정보를 제공합니다. 가장 간단한 authentication 관리 방법입니다. 다른 서비스를 사용하지 않아도 되죠.


Configuration


PasswdAuthentication authority 는 standard에 2개의 value만이 추가 됩니다.

  • PASSWD_USER_FILE - a path to the user file. This file can be placed anywhere, but it is recommended to place it in the DATA_DIR folder which is mapped to SITE_DIR/data. i.e. If you use the DATA_DIR constant it should not be in quotes: DATA_DIR”/users”

  • PASSWD_GROUP_FILE - a path to the group file. This file can be placed anywhere, but it is recommended to place it in the DATA_DIR folder which is mapped to SITE_DIR/data. i.e. If you use the DATA_DIR constant it should not be in quotes: DATA_DIR”/groups”



Format of the user file


이 user file은 전형적인 유닉스의 passwd 파일과 그 구조가 비슷합니다.

각 라인은 single user를 말합니다. 빈 줄이나 #로 시작하는 줄은 무시될 겁니다. 각 라인에는 : 로 구분되는 field들이 있습니다. 필드의 순서는 아래와 같습니다.

  1. userID - a short name for the user
  2. password - an md5 hash of the user’s password (unix users can use md5 -s “password” to generate a hash)
  3. email - the email address of the user
  4. full name - the full name of the user


Format of the group file


그룹 파일도 유닉스의 그룹파일과 아주 비슷합니다.


각 라인은 single group을 나타냅니다. 빈 줄이나 #로 시작하는 줄은 무시됩니다. 각 라인에서 각 필드들은 : 로 구분 됩니다.

그 필드들의 순서는 아래와 같습니다.


  1. group - a short name for the group
  2. gid - a numerical id for the group
  3. members - a comma separated list of users. Each user is represented by their username/email. If the user is from another authority you should enter it as authority|userID


Usage


이 authority를 사용하는 것은 몇개의 account 만을 다룰 때 유용할 겁니다. 예를 들어 간단하게 username과 password를 가지고 몇개의 모듈만 protect 하기를 원하는 경우가 이것에 해당 될 겁니다.




반응형

Access Control and Authorization

2012. 9. 6. 03:53 | Posted by 솔웅


반응형

Access Control and Authorization


유저의 identity를 얻으면 그 identity 에 근거해서 제한된 모듈을 사용할 수 있도록 하는 authorize 가 가능해 집니다. Authorization은 access control lists에 의해서 이뤄 집니다. 개발자들은 아마 다른 contexts에 더 익숙하시겠죠? 예를 들어 파일 시스템 같은......


Access Control Lists


access control list 는 어떤 리소스에 접근이 가능한 이들을 정의해 놓은 rule들을 열거한 겁니다. (ALLOW rules) 물론 그 리소스에 어떤 이들의 접근을 막을지에 대해서도 정의해 놓을 수 있겠죠. (DENY rules). 룰들은 유저와 그룹별로 정의 될 수 있습니다. 여러분 사이트의 필요에 따라 혼합하거나 해서 사용하실 수 있습니다.


Access control lists SITE_DIR/config/acls.ini  (site authorization)나 SITE_DIR/config/MODULE/acls.ini (module authorization)에 정의 돼 있습니다. 


만약 그 site 에 access control list entry가 있다면 (in SITE_DIR/config/acls.ini), 이 조건은 모든 모듈에 적용이 될 겁니다. site가 아니라 module 이 access control list entry 를 가지고 있다면 (in SITE_DIR/config/MODULE/acls.ini), acl 룰에 맞는 유저만이 접근할 수 있게 됩니다.


아래와 같은 경우에 유저는 접근 권한을 가질 겁니다.


  • They match an ALLOW rule, AND
  • They do NOT match a DENY rule


만약 유저가 DENY 룰에 속하면 즉각 접근 제한이 됩니다.

이 Access control lists 는 Administration Console에서 수정될 수 있습니다.




Syntax of Access Control Lists


각각의 ACL은 acls.ini 파일에 있는 section입니다. 첫번째 ACL은 section 0 가 되고 두번째는 1 이 됩니다. 각 섹션은 key들을 가지고 있습니다.


  • type: Either U (for user access, i.e. who can use the module), or A (for admin access, who can administer the module).
  • action: Either A (allow) or D (deny). Deny rules always take precedence.
  • scope: Either U (user), G (group) or E (everyone, i.e. ALL users, including anonymous users),
  • authority: The index of the authority. For user scope this can be blank and would match a user from any authority.
  • value: The particular user/group to match. For user scope this can be “*” which would match all authenticated users.


이 신택스를 구현하는 방법을 이해하시려면 아래 예제를 보세요.

admin 모듈에 대해 만드려면 아래와 같이 될 겁니다.



[0]
type = "U"
action = "A"
scope = "G"
authority = "ldap"
value = "admin"

[1]
type = "U"
action = "A"
scope = "G"
authority = "ad"
value = "domainadmins"

[2]
type = "U"
action = "D"
scope = "U"
authority = "ad"
value = "Administrator"



이 의미는 ldap authority 의 admin 그룹의 멤버들과 ad authority 의 domainadmin 그룹들에게 접근이 허용 될 겁니다.  그리고 특별히 ad authority의 Administrator 그룹에는 접근이 허용되지 않습니다.


Using the Flat-file Authority to extend other authorities


flat file authority 인 PasswdAuthentication는 다른 시스템이 아닌 웹서버에 저장돼 있는 flat-file을 사용해서 유저나 그룹들에게 접근을 허용할 수 있습니다. 이 경우는 유저가 적어서 굳이 authority 시스템을 관리하느라 시간을 낭비하고 싶지 않은 경우에 유용하게 사용 될 수 있습니다.


그리고 데이터베이스 서버(혹은 SQLite)가 있고 여러분이 그것을 관리하고 있다면 이 데이터베이스에 저장된 값을 가지고 사용하는 DatabaseAuthentication authority 도 사용할 수 있습니다.



이러한 방법들에 대해 좀 더 알고 싶으시면 instruction을 참조하세요. 유저 login을 사용하고 싶지 않다면 USER_LOGIN을 NONE으로 세팅해 놓으세요.



반응형

JSON 파일 만드는데 도움 주는 툴

2012. 8. 20. 21:00 | Posted by 솔웅


반응형

jQuery Mobile로 웹앱을 만들다 보니 JSON 파일을 많이 다룰 것 같습니다.


그래서 샘플로 Mockup wireframe 만들다 보니까 JSON 파일을 사용하는 샘플 앱을 만들었습니다.


현업들로부터 엑셀 파일로 데이터를 전달 받는데요.

이걸 JSON 파일로 쉽게 만드는 방법이 뭘까 찾아보다가 이 작업을 도와주는 싸이트를 찾았습니다.


Mr. Data Converter


이 싸이트는 엑셀파일에서 그냥 Copy 하거나 CSV에서 데이터를 Copy 한 후에 아래 select menu에서 원하는 파일 형식을 고르시면 됩니다.




Christopher Parker의 CSV to json




이 싸이트는 CSV를 JSON 형식으로 바꿔줍니다.




모두 자바스크립트로 이뤄졌는데요.

위쪽 오른쪽의 View Source를 누르시면 원본 파일도 보실 수 있습니다.


따로 로컬에 복사해서 사용하실수도 있구요.



cvsToJson.html


반응형

CSS Sprite Image 관련 팁

2012. 8. 17. 09:41 | Posted by 솔웅


반응형

CSS Sprite Image 작업을 할 때 고민 되는 거는 어떻게 여러 이미지를 한개의 이미지로 만들고 이것을 어떻게 CSS로 코드화 하느냐 입니다.


코로나 SDK 에서도 Sprite Image 작업을 할 때 똑같은 문제가 있습니다.

코로나의 경우엔 3rd party 프로그램으로 손쉽게 할 수 있었는데요.


CSS Sprite Image 도 이 작업을 도와주는 툴이 있습니다.


CSS Sprite Generator 웹 사이트로 가면 되는데요.

웹 주소는 아래와 같습니다.


http://spritegen.website-performance.org/





가 보시면 한국말/조선말 로도 서비스가 됩니다.


사용 방법은 Sprite 로 만들 여러 이미지들을 zip 파일로 압축합니다.

그리고 위의 Choose File 버튼을 누르고 업로드 합니다.


그리고 나서 맨 아래에 있는 CSS Sprite Image & CSS 버튼을 누르면 됩니다.




그러면 위와 같은 결과가 나오는데요.

저 CSS 코드는 긁어다가 활용하시면 되구요.

Sprite Image는 아래 Download Sprite Image 버튼을 눌러서 다운 받으시면 됩니다.


그리고 또 한가지 팁으로 웹 로딩 속도를 테스트 하는 페이지가 있는데요.


http://webwait.com/




사용 방법은 왼쪽 위에 웹 주소를 넣고 (로컬 컴퓨터에 아파치 같은 웹 서버가 깔려 있으면 localhost 도 작동 하더라구요.) 버튼을 누릅니다.


그러면 5번 로딩을 시도해서 그 평균값을 표시해 줍니다.

로딩 시도 횟수는 마음대로 정하실 수도 있습니다.


반응형

CSS Image Sprites 실습 해 보기

2012. 8. 16. 05:06 | Posted by 솔웅


반응형

CSS Image Sprites


Image Sprites는 여러 이미지들을 하나의 이미지 파일로 합쳐 넣는 겁니다.

웹페이지에 이미지가 많으면 일일이 server에 request 해야 되기 때문에 로딩 시간이 많이 걸립니다.

CSS Image Sprites를 사용하면 server request를 줄이고 퍼포먼스를 향상시킬 수 있습니다.




위 이미지에는 집과 좌 우 화살표가 있습니다.

한개의 이미지 인데요.

이것을 집, 왼쪽 화살표, 오른쪽 화살표 이렇게 따로 따로 분리해서 하나의 이미지로 사용할 수 있습니다.


위 이미지는 http://www.w3schools.com/css/img_navsprites.gif 에 있습니다.


<!DOCTYPE html>
<html>
<head>
<style type="text/css">
#navlist{position:relative;}
#navlist li{margin:0;padding:0;list-style:none;position:absolute;top:0;}
#navlist li, #navlist a{height:44px;display:block;}

#prev{left:0px;width:43px;}
#prev{background:url('http://www.w3schools.com/css/img_navsprites.gif') 87px 0;}

#home{left:60px;width:46px;}
#home{background:url('http://www.w3schools.com/css/img_navsprites.gif') 0 0;}

#next{left:129px;width:43px;}
#next{background:url('http://www.w3schools.com/css/img_navsprites.gif') 177px 0;}
</style>
</head>

<body>
<ul id="navlist">
  <li id="prev"><a href="#"></a></li>
  <li id="home"><a href="#"></a></li>
  <li id="next"><a href="#"></a></li>
</ul>
</body>
</html>



html 파일을 만들고 위 소스코드를 붙여 넣어 보세요.


그러면 아래와 같이 브라우저에 표시 됩니다.



하나만 분석해 보면

#prev{left:0px;width:43px;}
#prev{background:url('img_navsprites.gif') 87px 0;}


첫번째 left 는 브라우저 상의 위치 입니다. 그러니까 0포인트에서 width 43 픽셀까지를 이용할 거라고 먼저 해 놓고 그 다음에 이미지를 넣습니다.

이미지는 img_navsprites.gif 의 87픽셀서부터 표시합니다. 그러면 87픽셀부터 가로로 43픽셀이 표시 되겠죠.

이게 왼쪽 화살표 입니다.


다른 소스코드 볼까요?


<!DOCTYPE html>
<html>
<head>
<style type="text/css">
#navlist{position:relative;}
#navlist li{margin:0;padding:0;list-style:none;position:absolute;top:0;}
#navlist li, #navlist a{height:44px;display:block;}

#home{left:0px;width:46px;}
#home{background:url('http://www.w3schools.com/css/img_navsprites_hover.gif') 0 0;}
#home a:hover{background: url('http://www.w3schools.com/css/img_navsprites_hover.gif') 0 -45px;}

#prev{left:63px;width:43px;}
#prev{background:url('http://www.w3schools.com/css/img_navsprites_hover.gif') -47px 0;}
#prev a:hover{background: url('http://www.w3schools.com/css/img_navsprites_hover.gif') -47px -45px;}

#next{left:129px;width:43px;}
#next{background:url('http://www.w3schools.com/css/img_navsprites_hover.gif') -91px 0;}
#next a:hover{background: url('http://www.w3schools.com/css/img_navsprites_hover.gif') -91px -45px;}
</style>
</head>

<body>
<ul id="navlist">
  <li id="home"><a href="#"></a></li>
  <li id="prev"><a href="#"></a></li>
  <li id="next"><a href="#"></a></li>
</ul>
</body>
</html>


이것의 원본 이미지는 아래 이미지 입니다.



마우스가 오버 되면 밑의 어두운 이미지가 표시 되도록 하는 것이죠.


직접 만들어서 해 보세요.


마지막 소스코드를 한번 보겠는데요.


<!DOCTYPE html>
<html>
<head>
<style type="text/css">
img.home
{
width:46px;
height:44px;
background:url(http://www.w3schools.com/css/img_navsprites.gif) 0 0;
}
img.next
{
width:43px;
height:44px;
background:url(http://www.w3schools.com/css/img_navsprites.gif) -91px 0;
}
img.before
{
width:43px;
height:44px;
background:url(http://www.w3schools.com/css/img_navsprites.gif) 87px 0;
}
</style>
</head>

<body>
<img class="home"  width="1" height="1" />
<br /><br />
<img class="next"  width="1" height="1" />
<br /><br />
<img class="before"  width="1" height="1" />
</body>
</html>


이 소스코드가 원래는 http://www.w3schools.com 의 CSS image sprites 튜토리얼 첫번째 나온 겁니다.


그런데 제 컴퓨터에서는 크롬에서만 제대로 표시 되서 맨 마지막에 놨습니다.


브라우저에 표시되는 것은 저 위의 첫번째 소스하고 똑 같습니다.


실무에서는 이미지가 많이 들어갈 경우 퍼포먼스를 향상시키기 위해 이 효과를 써 보는 것도 좋을 것 같습니다.


이 sprite image 를 만들고 css 파일을 얻을 수 있는 싸이트로는 SpriteMe가 있습니다.

링크 따라 가셔서 한번 보세요.


그리고 관련 글로는 여기를 참조하세요.



sprite01.html


sprite02.html


sprite03.html


반응형