Skip to content

Commit

Permalink
Retrieved an access token from GitHub OAuth
Browse files Browse the repository at this point in the history
  • Loading branch information
achlipala committed Aug 27, 2016
0 parents commit 21ed3e9
Show file tree
Hide file tree
Showing 23 changed files with 652 additions and 0 deletions.
28 changes: 28 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
*~
configure
Makefile.in
Makefile
src/ur/config.urp
src/m4/libtool.m4
src/m4/ltoptions.m4
src/m4/ltsugar.m4
src/m4/ltversion.m4
src/m4/lt~obsolete.m4
missing
*.sub
*.guess
*.log
*.status
libtool
depcomp
install-sh
ltmain.sh
compile
ar-lib
*.m4
*.cache
src/c/.deps
src/c/.libs
*.lo
*.la
*.o
26 changes: 26 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
Copyright (c) 2010-2011, 2016, Adam Chlipala
Portions contributed by Robin Green and Karn Kallio in 2011.
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

- Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
- The names of contributors may not be used to endorse or promote products
derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
17 changes: 17 additions & 0 deletions Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
ACLOCAL_AMFLAGS = -I m4

LIB = @LIB@
INCLUDE = @INCLUDE@

LIB_UR = $(LIB)/ur/world

SUBDIRS = src/c

install-exec-local:
mkdir -p $(LIB_UR)
cp src/ur/*.urs $(LIB_UR)/
cp src/ur/*.ur $(LIB_UR)/
cp src/ur/*.urp $(LIB_UR)/
mkdir -p $(INCLUDE)
cp include/*.h $(INCLUDE)/
-ldconfig
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
An Ur/Web library for talking to popular Web services (e.g., for authentication)
2 changes: 2 additions & 0 deletions autogen.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/sh
autoreconf -fvi
39 changes: 39 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
AC_INIT([urweb_world], [1.0])
AC_USE_SYSTEM_EXTENSIONS
AM_INIT_AUTOMAKE([-Wall -Werror foreign no-define])
AC_PROG_CC()
AM_PROG_AR()
AC_PROG_LIBTOOL()
AC_CONFIG_MACRO_DIR([m4])

LIBCURL_CHECK_CONFIG(yes, [], [echo >/dev/null], [echo "You must install libcurl development files."; exit 1])

if test [$prefix = "NONE"]; then
prefix=/usr/local
fi

if test [-z $LIB]; then
LIB=$prefix/lib/urweb
fi

if test [-z $INCLUDE]; then
INCLUDE=$prefix/include/urweb
fi

AC_SUBST(LIB)
AC_SUBST(INCLUDE)

AC_CONFIG_FILES([
Makefile
src/c/Makefile
src/ur/config.urp
])

AC_OUTPUT()

cat <<EOF

Ur/Web World library configuration:
lib directory: LIB $LIB
include directory: INCLUDE $INCLUDE
EOF
3 changes: 3 additions & 0 deletions examples/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
basic_in.ur
*.exe
*.sql
1 change: 1 addition & 0 deletions examples/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
To run `Basic` example: copy `basic_in.urp.in` to `basic_in.urp` and fill in your GitHub application details.
12 changes: 12 additions & 0 deletions examples/basic.ur
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
structure O = Oauth.Make(struct
open Basic_in

val authorize_url = bless "https://github.com/login/oauth/authorize"
val access_token_url = bless "https://github.com/login/oauth/access_token"
end)

val after =
return <xml>Welcome back.</xml>

fun main () =
O.authorize {ReturnTo = url after}
10 changes: 10 additions & 0 deletions examples/basic.urp
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
rewrite all Basic/*
library ../src/ur
safeGet main
allow url https://github.com/*
database dbname=basic
sql basic.sql
prefix http://localhost:8080/

basic_in
basic
1 change: 1 addition & 0 deletions examples/basic.urs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
val main : unit -> transaction page
2 changes: 2 additions & 0 deletions examples/basic_in.ur.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
val client_id = "id"
val client_secret = "secret"
3 changes: 3 additions & 0 deletions include/world.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#include <urweb.h>

uw_Basis_string uw_WorldFfi_post(uw_context ctx, uw_Basis_string url, uw_Basis_string body);
Loading

0 comments on commit 21ed3e9

Please sign in to comment.