반응형

http://m.chromeexperiments.com

 

http://mudcu.be/

 

 

반응형
반응형

중국 사이트 QQ, weibo 가입하기

 


사이트 : qq.com




QQ메인페이지

QQ 초기화면 (오른쪽 상단 로그인 버튼)



로그인 화면 (두번째 버튼이 가입화면)


바로가는 주소 : zc.qq.com/en/index.html?from=pt




QQ 가입화면


QQ 가입 자체는 영문으로 되어있어서 어렵지 않게 할 수 있다.






자,

이제 웨이보(Weibo)

사이트 : http://weibo.com/




메인 화면

오른쪽 상단에 초록 버튼 클릭


중요!!

휴대폰 인증을 할 수 없기 때문에

이메일 가입으로 이동!


이메일로 변경되어 있는지 확인하고 가입!



가입 신청을 하면 다음과 같이 메일로 인증메일이 온다.

중간에 주소를 클릭



인증 후 웨이보 기본 정보를 입력하러 이동한다.


인증 성공 후 오는 확인 메일




로그인 후 첫 안내화면

왠지 귀여운 이미지



어플도 깔끔하니 잘 구성되어있는거 같고..

대체적으로 만족~




반응형

'프로그래밍 > Web' 카테고리의 다른 글

[CSS/JS] scroll-effects.  (0) 2012.11.27
[Chrome] Chrome Experiments Mobile  (0) 2012.11.27
[iPad] iPad mini detection  (0) 2012.11.13
[Web] 인증, 공용인증, OAuth - http://oauth.net/  (0) 2012.11.06
Firefox 기본폴더  (0) 2012.10.22
반응형

아이패드 미니가 나왔으니 7.9" 를 찾아내야 한다. 아이패드2(9.7")의 미니미같은 존재.

UI를 맞추기 위해서든.

에이전트는 아이패드2와 동일하다.  19% 작아보이는것이라고 한다.

 

구별할수 있는 방법이 없다는데. 과연 그럴까?

내부 브라우저 사이즈로 찾을수 있을거 같다.

아래 글을 참고하자.

 

Mission: Impossible – iPad mini detection for HTML5

http://www.mobilexweb.com/blog/ipad-mini-detection-for-html5-user-agent

반응형
반응형

OAuth는 OpenAPI로 개발된 표준 인증 방식으로, 각종 애플리케이션에서 사용자 인증을 거칠때 활용될 수 있다.

 

OAuth가 사용되기 전에는 인증방식의 표준이 없었기 때문에 기존의 기본인증인 아이디과 비밀번호를 사용하였는데, 이는 보안상 취약한 구조이다.

기본인증이 아닐 경우는 각 애플리케이션들이 각자의 개발한 회사의 방법대로 사용자를 확인하였다. 예를 들면 구글의 AuthSub, AOL의 OpenAuth, 야후의 BBAuth, 아마존의 웹서비스 API 등이 있다.

OAuth는 이렇게 제각각인 인증방식을 표준화한 인증방식이다. OAuth를 이용하면 이 인증을 공유하는 애플리케이션끼리는 별도의 인증이 필요없다. 따라서 여러 애플리케이션을 통합하여 사용하는 것이 가능하게 된다.


OAuth에 관련된 용어들
  ⊙ 사용자(user): 서비스 공급자와 소비자를 사용하는 계정을 가지고 있는 개인
  ⊙ 소비자(consumer): Open API를 이용하여 개발된 OAuth를 사용하여

                                  서비스 제공자에게 접근하는 웹사이 트 또는 애플리케이션
  ⊙ 서비스 공급자(service provider): OAuth를 통해 접근을 지원하는 웹 애플리케이션

                                                     (Open API를 제공하는 서비스)
  ⊙ 소비자 비밀번호(consumer secret) : 서비스 제공자에서 소비자가 자신임을 인증하기 위한 키
  ⊙ 요청 토큰(request token) : 소비자가 사용자에게 접근권한을 인증받기 위해 필요한 정보가 담겨있으며

                                            후에 접근 토큰으로 변환된다.
  ⊙ 접근 토큰(access token) : 인증 후에 사용자가 서비스 제공자가 아닌 소비자를 통해서 보호된 자원에

                                             접근하기 위한 키를 포함한 값.


OAuth인증은 소비자와 서비스 공급자 사이에서 일어나는데 이 인증 과정은 다음과 같다.
  1.소비자가 서비스제공자에게 요청토큰을 요청한다.
  2.서비스제공자가 소비자에게 요청토큰을 발급해준다.
  3.소비자가 사용자를 서비스제공자로 이동시킨다. 여기서 사용자 인증이 수행된다.
  4.서비스제공자가 사용자를 소비자로 이동시킨다.
  5.소비자가 접근토큰을 요청한다.
  6.서비스제공자가 접근토큰을 발급한다.
  7.발급된 접근토큰을 이용하여 소비자에서 사용자 정보에 접근한다.

 

http://oauth.net/

An open protocol to allow secure authorization in a simple and standard method from web, mobile and desktop applications.

Read the OAuth 2 specification »

 

The OAuth 2.0 authorization framework enables a third-party application to obtain limited access to an HTTP service.

For Consumer developers...

If you're building...

  • web applications
  • desktop applications
  • mobile applications
  • Javascript or browser-based apps
  • webpage widgets

OAuth is a simple way to publish and interact with protected data. It's also a safer and more secure way for people to give you access. We've kept it simple to save you time.

For Service Provider developers...

If you're supporting...

  • web applications
  • mobile applications
  • server-side APIs
  • mashups

If you're storing protected data on your users' behalf, they shouldn't be spreading their passwords around the web to get access to it. Use OAuth to give your users access to their data while protecting their account credentials.

 

http://helloworld.naver.com/helloworld/24942

  • OAuth와 로그인

    OAuth와 로그인은 반드시 분리해서 이해해야 한다. 일상 생활을 예로 들어 OAuth와 로그인의 차이를 설명해 보겠다.

    사원증을 이용해 출입할 수 있는 회사를 생각해 보자. 그런데 외부 손님이 그 회사에 방문할 일이 있다. 회사 사원이 건물에 출입하는 것이 로그인이라면 OAuth는 방문증을 수령한 후 회사에 출입하는 것에 비유할 수 있다.

    다음과 같은 절차를 생각해 보자.

  • 나방문씨(외부 손님)가 안내 데스크에서 업무적인 목적으로 김목적씨(회사 사원)를 만나러 왔다고 말한다.
  • 안내 데스크에서는 김목적씨에게 나방문씨가 방문했다고 연락한다.
  • 김목적씨가 안내 데스크로 찾아와 나방문씨의 신원을 확인해 준다.
  • 김목적씨는 업무 목적과 인적 사항을 안내 데스크에서 기록한다.
  • 안내 데스크에서 나방문 씨에게 방문증을 발급해 준다.
  • 김목적씨와 나방문씨는 정해진 장소로 이동해 업무를 진행한다.

    위 과정은 방문증 발급과 사용에 빗대어 OAuth 발급 과정과 권한을 이해할 수 있도록 한 것이다. 방문증이란 사전에 정해진 곳만 다닐 수 있도록 하는 것이니, '방문증'을 가진 사람이 출입할 수 있는 곳과 '사원증'을 가진 사람이 출입할 수 있는 곳은 다르다. 역시 직접 서비스에 로그인한 사용자와 OAuth를 이용해 권한을 인증받은 사용자는 할 수 있는 일이 다르다.

    OAuth에서 'Auth'는 'Authentication'(인증)뿐만 아니라 'Authorization'(허가) 또한 포함하고 있는 것이다. 그렇기 때문에 OAuth 인증을 진행할 때 해당 서비스 제공자는 '제 3자가 어떤 정보나 서비스에 사용자의 권한으로 접근하려 하는데 허용하겠느냐'라는 안내 메시지를 보여 주는 것이다. 다음의 화면 두 개는 각각 네이버와 미투데이에 접근 권한 요청이 있음을 알려 주는 화면이다. 미투데이의 경우에는 OAuth 인증 방식을 사용하지 않지만 인증 절차에 대한 예시 정도로 생각해 주기 바란다.

    o03.png

    그림 1 네이버 OAuth 접근 권한 요청 화면

    o01.png

    그림 2 미투데이 접근 권한 요청 화면

  •  

    OAuth를 이용하여 사용자를 인증을 하는 과정을 OAuth Dance라고 한다. 두 명이 춤을 추듯 정확하게 정보를 주고받는 과정을 재미있게 명명한 것이다.

    OAuth를 이해하려면 몇 가지 용어를 먼저 알아 두어야 한다. 다음 표에 OAuth의 대표 용어를 정리해 보았다.

    표 2 OAuth 1.0 대표 용어

    용어

    설명

    User

    Service Provider에 계정을 가지고 있으면서, Consumer를 이용하려는 사용자

    Service Provider

    OAuth를 사용하는 Open API를 제공하는 서비스

    Consumer

    OAuth 인증을 사용해 Service Provider의 기능을 사용하려는 애플리케이션이나 웹 서비스

    Request Token

    Consumer가 Service Provider에게 접근 권한을 인증받기 위해 사용하는 값. 인증이 완료된 후에는 Access Token으로 교환한다.

    Access Token

    인증 후 Consumer가 Service Provider의 자원에 접근하기 위한 키를 포함한 값

    다음은 OAuth 인증 과정을 그림으로 표현한 것이다.

     

    OAuth 인증 과정을 그림으로 표현한 것이다.

    그림 3 OAuth 1.0a 인증 과정(원본 출처: http://oauth.net/core/diagram.png)

    OAuth 인증 과정을 앞에서 설명한 회사 방문 과정과 연결하면 다음 표와 간다.

    표 3 회사 방문 과정과 OAuth 인증 과정

    회사 방문 과정

    OAuth 인증 과정

    1.

    나방문씨가 안내 데스크에서 업무적인 목적으로 김목적씨를 만나러 왔다고 말한다.

    Request Token의 요청과 발급

    2.

    안내 데스크에서는 김목적씨에게 나방문씨가 방문했다고 연락한다.

    사용자 인증 페이지 호출

    3.

    김목적씨가 안내 데스크로 찾아와 나방문씨의 신원을 확인해 준다.

    사용자 로그인 완료

    4.

    김목적씨는 업무 목적과 인적 사항을 안내 데스크에서 기록한다.

    사용자의 권한 요청 및 수락

    5.

    안내 데스크에서 나방문 씨에게 방문증을 발급해 준다.

    Access Token 발급

    6.

    김목적씨와 나방문씨는 정해진 장소로 이동해 업무를 진행한다.

    Access Token을 이용해 서비스 정보 요청

    위의 표에 따르면, Access Token은 방문증이라고 이해할 수 있다. 이 방문증으로 사전에 허락된 공간에 출입할 수 있다. 마찬가지로 Access Token을 가지고 있는 Consumer는 사전에 호출이 허락된 Service Provider의 오픈 API를 호출할 수 있는 것이다.

  • Request Token

    OAuth에서 Consumer가 Request Token 발급을 요청하고 Service Provider가 Request Token을 발급하는 과정은 "저 나방문입니다. 김목적씨를 만날 수 있을까요?"라고 말하는 절차에 비유할 수 있다.

    Request Token을 요청하는 Request 전문을 살펴보자. 다음은 네이버의 OAuth API로 Request Token을 요청하는 예이다.

    1
    2
    3
    4
    GET /naver.oauth?mode=req_req_token&oauth_callback=http://example.com/OAuthRequestToken.do&oauth_consumer_key=WEhGuJZWUasHg&oauth_nonce=zSs4RFI7lakpADpSsv&oauth_signature=wz9+ZO5OLUnTors7HlyaKat1Mo0=&oauth_signature_method=HMAC-SHA1&oauth_timestamp=1330442419&oauth_version=1.0 HTTP/1.1
    Accept-Encoding: gzip, deflate
    Connection: Keep-Alive
    Host: nid.naver.com

    보기 쉽도록 위의 내용을 아래와 같이 매개변수를 기준으로 정리했다.

    1
    2
    3
    4
    5
    6
    7
    8
    GET http://nid.naver.com/naver.oauth?mode=req_req_token&
    oauth_callback=http://example.com/OAuthRequestToken.do&
    oauth_consumer_key=WEhGuJZWUasHg&
    oauth_nonce=zSs4RFI7lakpADpSsv&
    oauth_signature=wz9+ZO5OLUnTors7HlyaKat1Mo0=&
    oauth_signature_method=HMAC-SHA1&
    oauth_timestamp=1330442419&
    oauth_version=1.0 HTTP/1.1

    Request Token 발급 요청 시 사용하는 매개변수는 다음 표와 같다.

    표 4 Request Token 발급 요청 시 사용하는 매개변수

    매개변수

    설명

    oauth_callback

    Service Provider가 인증을 완료한 후 리다이렉트할 Consumer의 웹 주소. 만약 Consumer가 웹 애플리케이션이 아니라 리다이렉트할 주소가 없다면 소문자로 'oob'(Out Of Band라는 뜻)를 값으로 사용한다.

    oauth_consumer_key

    Consumer를 구별하는 키 값. Service Provider는 이 키 값으로 Consumer를 구분한다.

    oauth_nonce

    Consumer에서 임시로 생성한 임의의 문자열. oauth_timestamp의 값이 같은 요청에서는 유일한 값이어야 한다. 이는 악의적인 목적으로 계속 요청을 보내는 것을 막기 위해서이다.

    oauth_signature

    OAuth 인증 정보를 암호화하고 인코딩하여 서명 값. OAuth 인증 정보는 매개변수 중에서 oauth_signature를 제외한 나머지 매개변수와 HTTP 요청 방식을 문자열로 조합한 값이다. 암화 방식은 oauth_signature_method에 정의된다.

    oauth_signature_method

    oauth_signature를 암호화하는 방법. HMAC-SHA1, HMAC-MD5 등을 사용할 수 있다.

    oauth_timestamp

    요청을 생성한 시점의 타임스탬프. 1970년1월 1일 00시 00분 00초 이후의 시간을 초로 환산한 초 단위의 누적 시간이다.

    oauth_version

    OAuth 사용 버전. 1.0a는 1.0이라고 명시하면 된다.

  • oauth_signature 만들기

    OAuth 1.0에서는 oauth_signature를 생성하는 것이 가장 까다로운 단계이다. 당연히 Consumer와 Service Provider가 같은 암호화(signing) 알고리즘을 이용하여 oauth_signature를 만들어야 한다.

    oauth_sinature는 다음과 같이 네 단계를 거쳐 만든다.

  • 1. 요청 매개변수를 모두 모은다.

    oauth_signature를 제외하고 'oauth_'로 시작하는 OAuth 관련 매개변수를 모은다. POST body에서 매개변수를 사용하고 있다면 이 매개변수도 모아야 한다.

  • 2. 매개변수를 정규화(Normalize)한다.

    모든 매개변수를 사전순으로 정렬하고 각각의 키(key)와 값(value)에 URL 인코딩(rfc3986)을 적용한다. URL 인코딩을 실시한 결과를 <key>=<value> 형태로 나열하고 각 쌍 사이에는 &을 넣는다. 이렇게 나온 결과 전체에 또 URL 인코딩을 적용한다.

  • 3. Signature Base String을 만든다.

    HTTP method 명(GET 또는 POST), Consumer가 호출한 HTTP URL 주소(매개변수 제외), 정규화한 매개변수를 '&'를 사용해 결합한다. 즉 '[GET|POST] + & + [URL 문자열로 매개변수는 제외] + & + [정규화한 매개변수]' 형태가 된다. 이 예제에서는 'http://nid.naver.com/naver.oauth'을 URL로 사용하고, 이 URL에 URL 인코딩을 적용한 값을 사용했다.

  • 4. 키 생성

    3번 과정까지 거쳐 생성한 문자열을 암호화한다. 암호화할 때 Consumer Secret Key를 사용한다. Consumer Secret Key는 Consumer가 Service Provider에 사용 등록을 할 때 발급받은 값이다. HMAC-SHA1 등의 암호화 방법을 이용하여 최종적인 oauth_signature를 생성한다.

  • 사용자 인증 페이지의 호출

    OAuth에서 사용자 인증 페이지를 호출하는 단계는 '안내데스크에서 김목적씨에게 방문한 손님이 있으니 안내 데스크로와서 확인을 요청하는 것'에 비유할 수 있다. Request Token을 요청하면, Service Provider는 Consumer에 Request Token으로 사용할 oauth_token과 oauth_token_secret을 전달한다. Access Token을 요청할 때는 Request Token의 요청에 대한 응답 값으로 받은 oauth_token_secret을 사용한다. Consumer가 웹 애플리케이션이라면 HTTP 세션이나 쿠키 또는 DBMS 등에 oauth_token_secret를 저장해 놓아야 한다.

    oauth_token을 이용해 Service Provider가 정해 놓은 사용자 인증 페이지를 User에게 보여 주도록 한다. 네이버의 경우 OAuth용 사용자 인증 페이지의 주소는 다음과 같다.

    1
    https://nid.naver.com/naver.oauth?mode=auth_req_token

    여기에 Request Token을 요청해서 반환받은 oauth_token을 매개 변수로 전달하면 된다. 예를 들면 다음과 같은 URL이 만들어 지게 되는 것이다. 이 URL은 사용자 인증 화면을 가리킨다.

    1
    https://nid.naver.com/naver.oauth?mode=auth_req_token&oauth_token=wpsCb0Mcpf9dDDC2

    로그인 화면을 호출하는 단계까지가 '안내 데스크에서 김목적씨에게 전화하는 단계'라 보면 되겠다. 이제 김목적씨가 안내 데스크로 와서 나방문씨를 확인해야 한다. 정말 나방문씨가 맞는지 아닌지 확인하는 과정이 필요할 것이다. 이 과정이 OAuth에서는 Service Provider에서 User를 인증하는 과정이라고 볼 수 있다.

    인증이 완료되면 앞에서 말한 바와 같이 어떤 권한을 요청하는 단계에 이르게 된다. "업무 약속이 있어 오셨으니 나방문씨가 출입할 수 있게 해 주세요"와 같은 것 말이다.

    인증을 마치면 Consumer가 oauth_callback에 지정한 URL로 리다이렉트한다. 이때 Service Provider는 새로운 oauth_token과 oauth_verifier를 Consumer에 전달한다. 이 값들은 Access Token을 요청할 때 사용한다.

  • Access Token 요청하기

    OAuth에서의 AccessToken은 나방문 씨에게 지급할 방문증과 같다.

    Access Token을 요청하는 방법은 Request Token을 요청하는 방법과 거의 같다. 다만, 사용하는 매개변수의 종류가 약간 다르고 oauth_signature를 생성할 때 사용하는 키가 다르다. Access Token 을 요청할 때에는 매개변수 oauth_callback는 없고, oauth_token와 oauth_verifer가 있다.

    Request Token 발급을 요청할 때에는 Consumer Secret Key를 사용해 oauth_token_secret를 생성했다. Access Token 발급을 요청할 때에는 Consumer Secret Key에 oauth_token_secret을 결합한 값(Consumer Secret Key + & + oauth_token_secret)을 사용해 oauth_token_secret를 생성한다. 암호화 키를 변경하여 보안을 더 강화하는 것이다.

    Access Token 발급을 요청할 때 사용하는 매개변수는 다음 표와 같다.

    표 5 Access Token 발급 요청을 위한 OAuth 매개변수

    매개변수

    설명

    oauth_consumer_key

    Consumer를 구별하는 키 값. Service Provider는 이 키 값으로 Consumer를 구분한다.

    oauth_nonce

    Consumer에서 임시로 생성한 임의의 문자열. oauth_timestamp의 값이 같은 요청에서는 유일한 값이어야 한다. 이는 악의적인 목적으로 계속 요청을 보내는 것을 막기 위해서이다.

    oauth_signature

    OAuth 인증 정보를 암호화하고 인코딩하여 서명 값. OAuth 인증 정보는 매개변수 중에서 oauth_signature를 제외한 나머지 매개변수와 HTTP 요청 방식을 문자열로 조합한 값이다. 암화 방식은 oauth_signature_method에 정의된다.

    oauth_signature_method

    oauth_signature를 암호화하는 방법. HMAC-SHA1, HMAC-MD5 등을 사용할 수 있다.

    oauth_timestamp

    요청을 생성한 시점의 타임스탬프. 1970년1월 1일 00시 00분 00초 이후의 시간을 초로 환산한 초 단위의 누적 시간이다.

    oauth_version

    OAuth 사용 버전

    oauth_verifier

    Request Token 요청 시 oauth_callback으로 전달받은 oauth_verifier 값

    oauth_token

    Request Token 요청 시 oauth_callback으로 전달받은 oauth_token 값

    위의 표에 정의한 매개변수를 상황에 맞게 정의한 다음 Access Token을 요청하면 oauth_token과 oauth_token_secret을 전달받게 된다. Service Provider에 따라 사용자의 아이디나 프로필 정보 같은 것들이 반환되기도 한다.

  • Access Token 사용하기

    드디어 방문증이 발급됐다. 이제 출입문을 통과하는 일만 남았다. 방문증을 가지고 출입문을 통과한다는 것은 User의 권한으로 Service Provider의 기능을 사용하는 것과 비슷하다. 다시 말해, 권한이 필요한 오픈 API를 호출할 수 있게 되는 것이다.

    가령 네이버 카페에서 게시판 목록을 가져온다고 한다면 호출해야 하는 URL은 다음과 같다.

    1
    http://openapi.naver.com/cafe/getMenuList.xml

    특정 User의 권한을 가지고 카페 게시판 목록 반환 URL을 요청해야 해당 User가 가입한 카페의 게시판 목록을 반환받을 수 있을 것이다. 이 URL을 호출할 때는 OAuth 매개변수를 함께 전달해야 한다.

    다음은 Access Token을 사용해 오픈 API를 요청하는 예이다. HTTP 헤더에 Authorization 필드를 두었고, Authorization 필드의 값 부분에 OAuth 매개변수 적는다. Access Token을 사용할 때는 GET이나 POST가 아닌 HEAD 방식을 사용한다.

    1
    2
    3
    4
    5
    6
    POST /cafe/getMenuList.xml HTTP/1.1
    Authorization: OAuth oauth_consumer_key="dpf43f3p2l4k3l03",oauth_token="nSDFh734d00sl2jdk"
    ,oauth_signature_method="HMACSHA1",oauth_timestamp="1379123202",oauth_nonce="chapoH",oauth_signature="MdpQcU8iPSUjWoN%2FUDMsK2sui9I%3D"
    Accept-Encoding: gzip, deflate
    Connection: Keep-Alive
    Host: http://openapi.naver.com

    보기 쉽도록 Authorization 필드를 아래와 같이 매개변수를 기준으로 정리했다.

    1
    2
    3
    4
    5
    6
    Authorization: OAuth oauth_consumer_key="dpf43f3p2l4k3l03",
    oauth_token="nSDFh734d00sl2jdk",
    oauth_signature_method="HMACSHA1",
    oauth_timestamp="1379123202",
    oauth_nonce="csrrkjsd0OUhja",
    oauth_signature="MdpQcU8iPGGhytrSoN%2FUDMsK2sui9I%3D"

    Access Token을 사용해 오픈 API를 호출할 때 사용하는 매개변수는 다음 표와 같다.

    표 6 Access Token을 사용해 오픈 API를 호출 할 때 필요한 OAuth 매개변수

    매개변수

    설명

    oauth_consumer_key

    Consumer를 구별하는 키 값. Service Provider는 이 키 값으로 Consumer를 구분한다.

    oauth_nonce

    Consumer에서 임시로 생성한 임의의 문자열. oauth_timestamp의 값이 같은 요청에서는 유일한 값이어야 한다. 이는 악의적인 목적으로 계속 요청을 보내는 것을 막기 위해서이다.

    oauth_signature

    OAuth 인증 정보를 암호화하고 인코딩하여 서명 값. OAuth 인증 정보는 매개변수 중에서 oauth_signature를 제외한 나머지 매개변수와 HTTP 요청 방식을 문자열로 조합한 값이다. 암화 방식은 oauth_signature_method에 정의된다.

    oauth_signature_method

    oauth_signature를 암호화하는 방법. HMAC-SHA1, HMAC-MD5 등을 사용할 수 있다.

    oauth_timestamp

    요청을 생성한 시점의 타임스탬프. 1970년1월 1일 00시 00분 00초 이후의 시간을 초로 환산한 초 단위의 누적 시간이다.

    oauth_version

    OAuth 버전

    oauth_token

    oauth_callback으로 전달받은 oauth_token

    주의

    Access Token을 이용해 요청할 때, Service Provider에 따라 realm이라는 매개변수를 사용해야 하는 경우도 있다. realm은 optional 매개변수인데, WWW-Authenticate HTTP 헤더 필드에서 사용하는 값이다.

  • OAuth 2.0

    OAuth 1.0은 웹 애플리케이션이 아닌 애플리케이션에서는 사용하기 곤란하다는 단점이 있다. 또한 절차가 복잡하여 OAuth 구현 라이브러리를 제작하기 어렵고, 이런저런 복잡한 절차 때문에 Service Provider에게도 연산 부담이 발생한다.

    OAuth 2.0은 이러한 단점을 개선한 것이다. OAuth 1.0과 호환성이 없고, 아직 최종안이 발표된 것은 아니지만 여러 인터넷 서비스 기업에서 OAuth 2.0을 사용하고 있다.

    OAuth 2.0의 특징은 다음과 같다.

    • 웹 애플리케이션이 아닌 애플리케이션 지원 강화
    • 암호화가 필요 없음
      HTTPS를 사용하고 HMAC을 사용하지 않는다.
    • Siganature 단순화
      정렬과 URL 인코딩이 필요 없다.
    • Access Token 갱신
      OAuth 1.0에서 Access Token을 받으면 Access Token을 계속 사용할 수 있었다. 트위터의 경우에는 Access Token을 만료시키지 않는다. OAuth 2.0에서는 보안 강화를 위해 Access Token의 Life-time을 지정할 수 있도록 했다.

    이외에도 OAuth 2.0에서 사용하는 용어 체계는 OAuth 1.0과 완전히 다르다. 같은 목적의 다른 프로토콜이라고 이해는 것이 좋다. 하지만 아직 최종안이 나오지 않았기 때문에, 현재로서는 OAuth 2.0의 특징만 파악하는 것으로도 충분할 듯 하다.

  • 반응형
    반응형

    프로필 폴더 장소

    Firefox 프로필 폴더의 기존 장소는 %APPDATA%\Mozilla\Firefox\Profiles\xxxxxxxx.default\입니다.

    • %APPDATA%는 C:\Users\<username>\AppData\Roaming\ 폴더 (Windows 7/Vista) 또는C:\Documents and Settings\<username>\Application Data\ 폴더 (Windows XP/2000)의 단축 이름이며, 여러분의 Windows의 사용자 계정 정보 이름에 따릅니다.
    • 위의 xxxxxxxx는 8 문자의 랜덤 문자열입니다.

    아래 설명에 따라서 여러분의 프로필 폴더를 열어 주십시오:

    반응형
    반응형

    이클립스에서 대소문자 변환하기 


    변환할 단어를 블럭선택하고 


    1.소문자 변환은 블럭 지정후 ctrl + shift + y

    2. 대문자 변환은 블럭 지정후 ctrl + shift + x


    반응형
    반응형

    How to create QR code reader in HTML5 website

    There aren't many JavaScript decoders.

    There is one at http://www.webqr.com/index.html

    The easiest way is to run ZXing or similar on your server. You can then POST the image and get the decoded result back in the response.


    javascript QRCode scanner


    https://github.com/LazarSoft

    반응형
    반응형

    Chrome Dev Tools: Markup and Style

    브라우저, 개발자 도구, 스타일가이드

    http://net.tutsplus.com/tutorials/tools-and-tips/chrome-dev-tools-markup-and-style/


    Browser Developer Tools

    Before digging into Chrome’s developer tools, I want to give you just a brief look at the development tools provided by the major browsers. Note that this isn’t a comprehensive look at these tools and their features, but I do provide basic information for each tool.

    Chrome Developer Tools

    You can use the developer tools within Chrome, Chrome Canary and even Chromium.

    Safari WebKit Inspector

    Safari uses code from the Web Inspector repository; however, you may find that it’s not updated as often as Chrome.

    Firefox Developer Tools

    Firefox now comes with its own set of developer tools which has a nice focus on the visual side of things. For those who are used to Firebug, that’s still available as an add-on.

    Internet Explorer Developer Tools

    Opera Dragonfly

    Getting Started

    Note: this tutorial uses the Canary build of Chrome. Therefore, some features covered in this article may or may not be available in the beta or stable releases.

    Before taking a look at the contents of the Elements panel, let’s take some time to understand the little controls near the top and bottom. Please refer to the numbered list below the following image that explains the different UI elements in the tool window.

    1. Close Developer Tools.
    2. Buttons to select different tool panels (Elements is currently selected).
    3. A custom tool installed by a third-party extention (PageSpeed).
    4. Change the layout of the developer tools.
    5. Show the console (will be covered in a different tutorial).
    6. Select an element in the tool by clicking on it in the page.
    7. JavaScript errors in the page.
    8. Open the settings screen overlay.

    It’s good to choose a layout you are comfortable with. Click once on the bottom-left corner and notice how the developer tools pane detaches itself from the main window–perfect for multi-monitor setups. Clicking and holding on the bottom left icon allows you dock to the right, like this:


    Elements Panel

    The Elements panel lists the page’s markup as it is rendered in the browser. Any change made to the DOM via JavaScript is reflected in the elements found in this panel.

    Let’s get familiar with this panel. As before, refer to the list items below the following screenshot that identify the different parts of the Elements panel.

    The power given to us by the dev tools is nothing short than amazing.

    1. The elements as rendered within the document.
    2. The arrow indicates that the element has children. The position of the arrow signifies whether the element is collapsed or expanded.
    3. Elemental breadcrumbs starting with the document element (<html/>) and ending with the currently selected element. Hovering over each crumb highlights the respective element in the browser window.
    4. A movable divider to separate the elements list from the style information.
    5. Togglable panes that contain styling (and more) information.
    6. Computed Styles show the styling information the browser calculated for the selected element.
    7. Shows you the styles inherited from the browser’s default styles that are applied to the selected element.
    8. Show you user added styles, such as: styles retrieved from the page’s corresponding styles.css file, styles added via JavaScript, and styles added via the developer tools.
    9. The “New style rule” button. It creates a new style rule for the selected element.
    10. Toggle Element State lets you trigger user initiated states such as :hover (the user hovering over something with their mouse, :active, and more. The image shows the button in its “on” state; it is off by default.
    11. The font section displays only the fonts that the browser has had to download.

    12. Allows you to set the preferred format for color values. You can keep the default (“as authored”), change everything to hex, use RGB, or even set it to HSL.
    13. Visualizes the element’s box by taking margin, border, and padding into account.

    Extra Information

    • What: The Elements panel allows for viewing and editing elements and style information.
    • Where: It’s the first panel. You can also access it by right-clicking an element on the page and selecting Inspect element.
    • Why: There are a number of use cases. You may wish to modify the DOM by deleting a node or adding a new one. Markup aside, the elements panel is a great place to see the applied styles of a specific node. You can also add and remove styles, as well as create new rules to possibly add to your stylesheets.

    DOM Modifications

    Modifying the DOM within the Elements panel is a fairly straightforward process. To delete a node, simply right-click it and select Delete node. As you might expect, deleting a parent node also deletes its children. Handy tip: You can also press the delete key on your keyboard to delete the selected node.

    Changing an element’s type is possible by double clicking on the element name itself. For example: the p portion on a paragraph tag. Naturally, changing an element from one type to another causes both the opening and closing tags to change.

    renaming an element

    Viewing the page’s resources is essential for debugging.

    Adding attributes can be achieved by right-clicking on the element and selecting Add attribute. The cursor immediately positions itself where you would expect it to, and you can start typing the attributes you want to add to the element. For example: class="title". Pressing the tab key on your keyboard positions the cursor to the next attribute position.

    Editing attributes is similar to adding them. Find the attribute you want to edit, and double click either the attribute name or its value. The former highlights the attribute name, and the latter highlights the value.

    Raw HTML editing is enabled by right-clicking on an element and selecting Edit as HTML.

    Locating Elements

    The developer tools provide a few useful techniquies for locating elements in the document. Hovering over elements in the Elements pane causes the corresponding rendered elements to be highlighted in the page. This is a great way to find which element in developer tools matches corresponds with the element in the page.

    Hovering over elements in the panel to locate them on the page

    Naturally, we do not see elements outside of the browser’s viewport highlighted when hovering over the corresponding elements in the Elements pane. Fortunately, we do see a tooltip indicating the direction of the out-of-viewport element. The icing on the cake, however, is the Scroll into view feature found within an element’s context menu. It does exactly what its says: it scrolls the element into view.

    Scrolling an element into view

    The developer tools also has a search feature. While the dev tools pane has focus, press Control + f to open the search box. This is a simple text search box; so, typing “body” will find the first instance of the text “body” in the document.

    Viewing Style Information

    Before we get to the style panes (the right hand side) of the Elements tab, we can access some style information directly from an element if it has all three of margins, paddings and borders specified in the stylesheet. Hovering over one of these elements gives us a glimpse at its box model, like this:

    result of hovering over an element

    When you’re wondering why some floated elements are not behaving as expected, viewing the margin/padding information can help diagnose the problem. For example, you may find that an element is wider than what you expected due to extra padding.

    While on the subject of margins/paddings/borders, let’s shift over to the styles area of the Elements panel and check out the “Metrics” pane.

    the metrics pane

    This allows you to drill-down and identify possible problems as to why an element renders the way it does. It’s also a great learning tool; if you haven’t gotten your head around the CSS Box Model, then the Metrics diagram is a great visual aid.

    The Metrics pane lets you view element dimensions, padding, borders and margins. Notice how you can highlight over each individual portion to get a visual representation as to how it renders in the browser. The Metrics diagram also gives pixel based measurements for each portion of the element, e.g. a style rule of padding: 10px 5px (10px at the top and bottom, 5px right and left) will show the exact measurements for each side of the element.

    Setting Style Information

    Viewing style information is fun, but immediately tinkering with any page’s style ranks much higher on the ‘ol fun meter. Whether it’s to educate ourselves, experiment with a design, or even communicate ideas to our peers, the power given to us by the dev tools is nothing short than amazing.

    Ensure the Styles panel is expanded and click just to the right of the opening curly bracket. You’ll notice a cursor automatically positions itself so that you can write a style property. Type a property name, press tab to move the cursor to the value portion, and type the value. I’m going to add the following CSS:

    border: 1px solid green
    

    The Elements panel lists the page’s markup as it is rendered in the browser.

    When you start typing in the property name, Chrome provides suggestions, giving you the benefit of auto-completion. Awesome! Pressing tab selects the closest match to what you typed and moves the cursor to the value position. However, pressing the right arrow key causes the cursor to remain in the property portion but fills in the closest match to what you typed.

    Auto-completion also works with property values. For example, typing in “pos” *tab* “fi” *tab* creates a style property of position: fixed. When entering pixel/percentage based values, such as 15% or 10px, we can increment and decrement those values using the up and down arrow keys. To increment by 10, use shift + up arrow key.

    Modifying color values is a breeze thanks to the color picker. After entering a color value, single-click on the small, colored square to the left of the value to bring up the color picker tool. You can also toggle between color value formats by shift+clicking the small colored square.

    You can create a new style rule by clicking the small + icon in the styles pane. Markup which looks like:

    <h1 id="something">Hello</h1>
    

    Automatically generates the following style rule:

    #something { }
    

    Markup which looks like:

    <h1 class="some-class">Hello</h1>
    

    Automatically generates the following:

    .some-class { }
    

    Markup which looks like:

    <h1>Hello</h1>
    

    Generates:

    .h1 { }
    

    Markup which looks like:

    <h1 class="class1 class2 class3">Hi there</h1>
    

    Automatically generates:

    .class1.class2.class3 { }
    

    Of course, style rules can be modified to your liking.

    The Elements panel gives you a lot of power with the structure and style of the page, but the dev tools give us many more tools essential to our work.


    Resources Panel

    The Resources panel shows what resources a page uses. Let’s take a look at what it provides.

    The Metrics pane lets you view element dimensions, padding, borders and margins.

    1. The button to active the Resources panel.
    2. The category pane shows the various types of resources we can inspect. A resource header (such as “Frames” or “Session Storage”) may have an error next to it. This indicates there is more information, and clicking on the header reveals that information. This pane is resizable; so make it as large or small as you like.
    3. Page resources including fonts, images, JavaScript, CSS and the page itself can be found here. If the page uses multiple frames (for example using a frameset), then each frame appears as a separate folder within the parent “Frames” folder. This is useful for understanding the relationship between a frame and its resources.
    4. If Web SQL databases are used in the page, this shows their contents.
    5. Similar to Web SQL, IndexedDB displays the contents of the IndexedDB database.
    6. Displays the key/value pairs stored in localStorage.
    7. Displays the key/value pairs stored in sessionStorage.
    8. Lists the cookies created by the domain.
    9. Displays the assets cached according to the cache manifest. This section contains a lot of useful information. For example, a resource such as a JavaScript library will show the resource path, file size, and file type.
    10. Displays the details regarding the selected resource in the left-hand pane.

    Extra Information

    The developer tools also has a search feature.

    • What: The resources panel shows resources associated with the page.
    • Where: The second panel, directly after the Elements panel and before the Network panel.
    • Why: Viewing the page’s resources is essential for debugging. You might also be curious as to what information other websites store in localStorage, cookies, or any other data storage mechanism. Additionally, certain resources, such as localStorage can be modified via the developer tools.

    Viewing Individual Frame Contents

    Despite the lack of frames usage in today’s web sites, understanding how to inspect a page with multiple frames is a valuable skill to have. In the following screenshot, you’ll notice a columned page where each column represents a different frame:

    viewing multiple frames

    You can save a resource to your computer

    Each frame is placed inside its own folder. Each folder contains each page's assets, and you can click on each page to show their contents. Viewing the contents of an HTML page is helpful, but we can go dig deeper into each page and view its resources. JavaScript, CSS, images, and even fonts can be viewed! Assets that contain code are displayed in the developer tools' code viewer, which comes with syntax highlighting and line numbers.

    Fonts

    It's important to note that system fonts, such as Arial or Helvetica, are not listed under Fonts; the font section displays only the fonts that the browser has had to download.

    Viewing the fonts of a page

    The font scales so that it can fit within the resource content area; therefore, resizing the resource content area also resizes the asset!

    Images

    It's clear that some thought went into the image viewing UI.

    Images within a page from the resources panel

    The developer tools displays the image in the content area, and the image scales according to the content area's size. Images with transparency (like the one in the above screenshot) are shown with a checkerboard in the background, making it easier to view the image. Other useful information, such as the dimensions, file size, and MIME type are displayed below the image.

    Scripts

    The JavaScript! Clicking a script file displays its contents, but not much else.

    JavaScript that a page has loaded

    But don't despair; viewing assets is simply that: viewing assets. In a future tutorial, we'll look at the dev tools' JavaScript support and capabilities.

    Stylesheets

    You can view the different stylesheets that the browser loaded for the web page.

    Stylesheets from Chrome dev tools

    As with JavaScript files, you cannot do much with the stylesheet assets.

    Resources that Failed to Load

    Occasionally, the browser will be unable to load a particular resource due to network issues or developer error.

    A resource which has not been found

    When this happens, a small red notification appears to the right of the asset. The number states how many errors occurred, and the content pane provides more details about the error.

    Saving and Viewing Resources

    Each resource has a context menu; simply right-clicking on a resource shows a menu similar to this:

    the context menu shown for assets

    You can save a resource to your computer, open a resource in a new tab, and perform many other tasks. Double-clicking the resource opens the asset in a new tab.

    Cookies

    As I previously mentioned, you can view cookie information for a particular website. For example, navigating to Twitter while being signed in may present similar information to what is shown in this screenshot:

    viewing the cookies on a page

    Here, we see:

    When you’re wondering why some floated elements are not behaving as expected, viewing the margin/padding information can help diagnose the problem.

    • Name - the name of the cookie. For example, there's a name with "remember_checked" which has a value of 1. This is likely to state whether the user has checked a "Remember me" checkbox during the sign in process.
    • Value - the value of the cookie. For the "_twitter_sess" named cookie, there's a long encrypted session ID for the value.
    • Domain - the cookie's domain. .twitter.com allows for any sub-domain on twitter.com.
    • Path - similar to domain, the path field states valid paths. "/" allows for all paths.
    • Expires - the date the browser delete the cookie.
    • Size - the size of the cookie in bytes.
    • HTTP - force the cookie to only be accessed via the HTTP protocol. This prevents accessing of cookies via JavaScript and can help combat cookie stealing through cross site scripting.
    • Secure - instructs the browser to communicate cookie data only through encrypted connections such as HTTPS

    You can delete a cookie by right-clicking on a cookie and selecting Delete from the context menu.

    It's interesting to note how browsers use cookie information to determine whether you are an authenticated user. While logged in to Twitter, deleting the "auth_token" and "_twitter_sess" cookies prompts us to login after refreshing the page. Twitter likely stores our logged in status and other bits of sensitive information in those cookies.

    Local Storage

    Storing and viewing key/value pairs in localStorage is rather easy. Rather than storing our own keys, we'll use an existing website as an example. The following screenshot shows the local storage view of a Kitchen Sink Example App made with the mobile web application framework Sencha Touch.

    Viewing the local storage on a page

    When first viewing the page, the browser makes a request for a CSS file. Refreshing the page feels a lot snappier because Sencha stored the CSS in local storage. The kitchen sink app has some interesting key/value pairs. For example, one key looks like this:

    3a867610-670a-11e1-a90e-4318029d18bb-http://dev.sencha.com/deploy/touch/examples/production/kitchensink/resources/css/app.css
    

    The value for that key begins with this:

    /*45e6f4ffe818855b26f3dcbfc156025eca58e4f5*/code,pre,pre *{font-family:Menlo,Monaco,Courier,monospace}
    

    Steve Souders wrote about storing assets in local storage; it's an interesting and exciting use of local storage which can improve performance--especially on mobile devices.

    Application Cache

    The application cache tells the browser which resources it should cache, and the Application Cache category lets us view what has been cached.

    the application cache view in the resources panel

    There are three columns with this view:

    • Resource - the full path of the resource. File extensions are typically assets and HTML files. One of the resources is the manifest file itself!
    • Type - can vary. The "Manifest" type is a unique type given to the manifest file itself. Another type is explicit: resources that are explicitly defined in the manifest file. The type of fallback indicates a resource that acts as a fallback for another resource. The Master type is the resource which initiated the cache: the page itself.
    • Size - the size of the resource in kilobytes or bytes.

    See this tutorial if you're not familiar with HTML5 application cache.



    반응형

    + Recent posts