Microsoft SAML 1.0 used for XBox
Ruby
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib
spec
.gitignore
Gemfile
LICENSE
README.md
Rakefile
ms_saml.gemspec

README.md

MS SAML 1.0

Build Status

This gem was extracted from working code and provided as sample. It's not very nicely build, but it's result of long hours investigating how SAML 1.0 should be formed for XBox Live.

Getting started

  • Supports Ruby version: 1.9.2

XBox Billing

In XBox Game Developer portal you can find some specifications describing how Purchase Ticket should work. In few words:

  1. Backend generate OrderToken SAML with product information and send it to client XBox
  2. Client XBox open billing dialog box with provided OrderToken SAML
  3. User press "Confirm", client XBox receives successfull transaction and reciept that formed same way as OrderToken
  4. Client XBox send OrderToken SAML to back-end, back-end validates it and confirm successfull transaction

OrderToken generation

Or generation of Signed SAML 1.0 for XBox live.

  private_key = OpenSSL::PKey::RSA.new(File.read('acme-company-private-key.pem'))

  key_identifier_64 = MsSaml::Xbox::OrderToken.get_key_identifier( public_key ) 
  options = {
    :issuer => '11111111111',
    :currency => 'USD', 
    :tax_included => 'True',
    :user_id => 'test@microsoft.com',
    :price => '1.99',
    :product_title => 'Product Title',
    :product_description => 'Product Description'
  }
   
  order_token = MsSaml::Xbox::OrderToken.construct(key_identifier64, private_key, options)

Contribution

Feel free to folk and improve code or tests for the project on Github. It's far from perfect code and it is provided "AS IT IS", hopefully someday XBox Live billing will move to SAML 2.0 and this code can be replaced with something more reliable such as Ruby-Saml gem. Till then, hopefully it will save few weeks of life trying to figure out "why this f**ing thing doesn't work".

License

MIT License. Copyright 2012 Ihor Ratsyborynskyy