Skip to content

Commit

Permalink
OKTA-381425: check state manager for null on sign out (#49)
Browse files Browse the repository at this point in the history
OKTA-381430: Don't fire SignInCompleted event on OAuthException (#50)
OKTA-233809: make demo application a submodule  (#51)
OKTA-373355: add TinyIoCContainer and related tests (#52)
OKTA-363613: add secure storage implementation and related tests (#56)

* OKTA-363613: add secure storage implementation and related tests

Co-authored-by: Laura Rodríguez <[email protected]>
OKTA-417977: correct handling of authserver id on  revoke and renew  (#59)

* OKTA-417977: correct handling of authserver id on revoke and renew

* add convenience methods to Revoke either access token or refresh token with a specified token
OKTA-420789: update version to 3.0.0 (#60)
OKTA-416273: add token access convenience methods (#63)
OKTA-421439: add ILogger and IOktaLogger interfaces (#62)
OKTA-428722: add AuthCodeExchangeExceptionThrown event (#66)
OKTA-427034: update readme and changelog (#64)
fix initialization race conditions, update build system (#68)
OKTA-432598: properly capture api exception on renew (#70)
fix nuget push script and update packages

OKTA-438287
<<<Jenkins Check-In of Tested SHA: d285f41 for [email protected]>>>
Artifact: okta-oidc-xamarin
Files changed count: 187
PR Link:
  • Loading branch information
bryanapellanes-okta authored and eng-prod-CI-bot-okta committed Oct 19, 2021
1 parent c53772e commit e4603e0
Show file tree
Hide file tree
Showing 187 changed files with 9,212 additions and 23,424 deletions.
19 changes: 14 additions & 5 deletions .bacon.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@
test_suites:
- name: PushNugetToArtifactory
script_name: nuget_push
script_path: /root/okta/okta-oidc-xamarin
- name: Run Unit Tests
script_name: unit_tests
script_path: /root/okta/okta-oidc-xamarin/.okta
sort_order: '1'
timeout: '15'
criteria: MERGE
queue_name: small
script_env:
BUILD_ENVIRONMENT: "BACON"
- name: Push Nugets to Artifactory
script_name: nuget_push
script_path: /root/okta/okta-oidc-xamarin/.okta
sort_order: '2'
timeout: '15'
criteria: OPTIONAL
queue_name: small

task_triggers:
post_merge:
- XamarinNugetArtifactoryUpload

58 changes: 58 additions & 0 deletions .github/workflows/build-nuget-packages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Build Okta.Xamarin nuget packages

on: [push]

jobs:
build-nuget-packages:

runs-on: macos-11

steps:
- uses: actions/checkout@v2

- name: Create artifacts directory
run: mkdir -p ./artifacts

- name: Set default Xamarin SDK versions
run: |
$VM_ASSETS/select-xamarin-sdk-v2.sh --mono=6.12 --ios=14.10
- name: Setup .NET Core SDK 5.0.x
uses: actions/setup-dotnet@v1
with:
dotnet-version: '5.0.x'

- name: Nuget restore
run: |
nuget restore ./Okta.Xamarin/Okta.Xamarin/Okta.Xamarin.csproj &&
nuget restore ./Okta.Xamarin/Okta.Xamarin.iOS/Okta.Xamarin.iOS.csproj &&
nuget restore ./Okta.Xamarin/Okta.Xamarin.Android/Okta.Xamarin.Android.csproj &&
nuget restore ./Okta.Xamarin/Tests/Okta.Xamarin.Test/Okta.Xamarin.Test.csproj
- name: Run Unit Tests
working-directory: ./Okta.Xamarin/Tests/Okta.Xamarin.Test
run: dotnet test

- name: Build common (Okta.Xamarin) nuget package
run: nuget pack ./Okta.Xamarin/Okta.Xamarin/Okta.Xamarin.csproj -Build

- name: Build iOS (Okta.Xamarin.iOS) nuget package
run: nuget pack ./Okta.Xamarin/Okta.Xamarin.iOS/Okta.Xamarin.iOS.csproj -Build

- name: Build Android (Okta.Xamarin.Android) nuget package
run: nuget pack ./Okta.Xamarin/Okta.Xamarin.Android/Okta.Xamarin.Android.csproj -Build

- name: Copy nuget artifacts
run: mv *.nupkg `pwd`/artifacts

- name: Set GIT_COMMIT
run: echo "GIT_COMMIT=$(echo $GITHUB_SHA | cut -c 1-7)" >> $GITHUB_ENV

- name: Set artifacts path
run: echo "ARTIFACTS=`pwd`/artifacts" >> $GITHUB_ENV

- name: Upload artifacts
uses: actions/upload-artifact@v2
with:
name: Okta.Xamarin-ARTIFACTS-${{ env.GIT_COMMIT }}
path: ${{ env.ARTIFACTS }}
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "Okta.Xamarin/Samples/xamarin"]
path = Okta.Xamarin/Samples/xamarin
url = https://github.com/okta/samples-xamarin.git
94 changes: 94 additions & 0 deletions .okta/functions.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
#!/bin/bash

function configureEnvironment(){
echo '<nuget_push.sh.configuringEnvironment>'

echo 'Assuming OS is Centos 7 (with yum)'
yum -y update

echo 'Installing openjdk 8'
yum -y install java-1.8.0-openjdk
export JAVA_HOME=/usr/java/jdk1.8.0_45
export PATH=$PATH:$JAVA_HOME/bin
export CLASSPATH=.:$JAVA_HOME/jre/lib:$JAVA_HOME/lib:$JAVA_HOME/lib/tools.jar
java -version
echo 'JAVA_HOME is'
echo $JAVA_HOME

echo 'Checking for unzip'
if ! [ -x "$(command -v unzip)" ]; then
yum -y install unzip
echo 'Installed unzip'
else
echo 'unzip already installed'
fi

echo 'Installing Android tools'
curl https://dl.google.com/android/repository/commandlinetools-linux-6609375_latest.zip -o android-sdk.zip
unzip android-sdk.zip -d ./cmdline-tools/
rm android-sdk.zip

yes | ./cmdline-tools/tools/bin/sdkmanager tools
./cmdline-tools/tools/bin/sdkmanager --update
./cmdline-tools/tools/bin/sdkmanager --list
yes | ./cmdline-tools/tools/bin/sdkmanager --licenses

# ensure that mono is installed, assumes host has yum (CentOS 7)
echo 'Checking for mono'
if ! [ -x "$(command -v mono)" ]; then
echo 'Mono is not installed.'
echo 'Installing Mono...'
rpmkeys --import 'http://pool.sks-keyservers.net/pks/lookup?op=get&search=0x3fa7e0328081bff6a14da29aa6a19b38d3d831ef'
su -c 'curl https://download.mono-project.com/repo/centos7-stable.repo | tee /etc/yum.repos.d/mono-centos7-stable.repo'
yum -y install mono-complete
fi
mono --version

# ensure that dotnet is installed, assumes host has yum (CentOS 7)
echo 'Checking for dotnet'
if ! [ -x "$(command -v dotnet)" ]; then
yum install -y ca-certificates
update-ca-trust force-enable
curl -O http://ca.okta.com/Okta-Global-CA.pem
curl -O http://ca.okta.com/Okta-Infrastructure-CA.pem
curl -O http://ca.okta.com/Okta-Internet-CA.pem
curl -O http://ca.okta.com/Okta-Root-CA.pem
chmod o+r *.pem
cp Okta-*.pem /etc/pki/ca-trust/source/anchors/
update-ca-trust extract
rpm -Uvh https://packages.microsoft.com/config/centos/7/packages-microsoft-prod.rpm
yum -y install dotnet-sdk-5.0
fi
echo 'dotnet version is:'
dotnet --version

echo 'Installing MonoDevelop'
rpm --import "http://keyserver.ubuntu.com/pks/lookup?op=get&search=0x3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF"
curl https://download.mono-project.com/repo/centos7-vs.repo | tee /etc/yum.repos.d/mono-centos7-vs.repo
yum -y install monodevelop

echo '</ nuget_push.sh.configuringEnvironment>'
}

function pushNugetsToArtifactory() {
# nuget source OKTA_NUGET_TOPIC_REPO and api key ${ARTIFACTORY_NUGET_APIKEY} are set by eng-productivity scripts run in bacon
echo "setting nuget source to artifactory"
NUGET_SOURCE="OKTA_NUGET_TOPIC_REPO"
NUGET_API_KEY=${ARTIFACTORY_NUGET_APIKEY}

if [ -d "./nuget/packages" ]; then
for NUGETPACKAGE in $(ls ./nuget/packages/*.nupkg)
do
if [ "$DRY_RUN" = true ] ; then
echo "export DRY_RUN=true"
echo "echo: dotnet nuget push ${NUGETPACKAGE} -k ${NUGET_API_KEY} -s ${NUGET_SOURCE}"
else
echo "PUSHING nuget package ${NUGETPACKAGE} to ${NUGET_SOURCE}"
echo "executing: dotnet nuget push ${NUGETPACKAGE} -k ${NUGET_API_KEY} -s ${NUGET_SOURCE}"
dotnet nuget push ${NUGETPACKAGE} -k ${NUGET_API_KEY} -s ${NUGET_SOURCE}
fi
done
else
echo "./nuget/packages: No nuget packages found";
fi
}
8 changes: 8 additions & 0 deletions .okta/nuget_push.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash

source ./functions.sh

configureEnvironment

cd ..
pushNugetsToArtifactory
8 changes: 8 additions & 0 deletions .okta/unit_tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash

source ./functions.sh

configureEnvironment

cd ../Okta.Xamarin/Tests/Okta.Xamarin.Test
dotnet test
45 changes: 45 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,51 @@
# Changelog
Running changelog of releases since `1.0.0-beta01`

## v3.0.0

Update/correct handling of authorization server Id. Conveniences added and internal structure changes made to support future additions and extensions.

### Fixes

- Check StateManager for null on sign out
- Don't fire SignInCompleted event on OAuthException

### Changes

- Refactored initialization process
- Make demo application a submodule

### Features

- Added convenience methods to OktaContext to manage loading and saving state.
- OktaContext.SaveStateAsync()
- OktaContext.LoadStateAsync()
- Added convenience methods for token revocation
- OktaContext.RevokeAccessToken(accessToken)
- OktaContext.RevokeRefreshToken(refreshToken)
- Added initialization related events to OktaContext
- InitServicesStarted
- InitServicesCompleted
- InitServicesException
- Added secure storage related events to OktaContext
- LoadStateStarted
- LoadStateCompleted
- LoadStateException
- SecureStorageWriteStarted
- SecureStorageWriteCompleted
- SecureStorageWriteException
- SecureStorageReadStarted
- SecureStorageReadCompleted
- SecureStorageReadException
- Added token related exception events to OktaContext
- RevokeException
- RenewException
- Added TinyIoCContainer
- Added convenience methods to IOktaStateManager
- GetAccessToken()
- GetRefreshToken()
- GetIdToken()

## v2.0.0

Cleanup and continued refinement of existing features.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,14 @@
<BundleAssemblies>false</BundleAssemblies>
<AndroidKeyStore>true</AndroidKeyStore>
<AndroidUseSharedRuntime>false</AndroidUseSharedRuntime>
<EmbedAssembliesIntoApk>true</EmbedAssembliesIntoApk>
<EmbedAssembliesIntoApk>false</EmbedAssembliesIntoApk>
<AndroidSigningKeyStore>.\Keystore\okta.xamarin.android-test\okta.xamarin.android-test.keystore</AndroidSigningKeyStore>
<AndroidSigningKeyAlias>okta.xamarin.android-test</AndroidSigningKeyAlias>
<AndroidSigningKeyPass>okta.xamarin.android-test</AndroidSigningKeyPass>
<AndroidSigningStorePass>okta.xamarin.android-test</AndroidSigningStorePass>
<AndroidSupportedAbis>
</AndroidSupportedAbis>
<AndroidCreatePackagePerAbi>true</AndroidCreatePackagePerAbi>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
Expand Down
25 changes: 25 additions & 0 deletions Okta.Xamarin/Okta.Xamarin.Android/Okta.Xamarin.Android.nuspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2013/05/nuspec.xsd">
<metadata>
<id>Okta.Xamarin.Android</id>
<version>3.0.0</version>
<authors>Okta, Inc.</authors>
<owners>Okta, Inc.</owners>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<licenseUrl>https://github.com/okta/okta-oidc-dotnet/blob/master/LICENSE.md</licenseUrl>
<projectUrl>https://github.com/okta/okta-oidc-xamarin</projectUrl>
<iconUrl>https://raw.githubusercontent.com/okta/okta-sdk-dotnet/master/icon.png</iconUrl>
<description>Official Okta OIDC SDK for Xamarin Android applications.</description>
<releaseNotes></releaseNotes>
<copyright>(c) 2021 Okta, Inc.</copyright>
<tags>okta token authentication authorization oauth sso oidc</tags>
<repository type="Git" url="https://github.com/okta/okta-oidc-xamarin.git" />
<dependencies>
<dependency id="Okta.Xamarin" version="3.0.0" />
<dependency id="System.Net.Http" version="4.3.4" />
<dependency id="Xamarin.Essentials" version="1.6.1" />
<dependency id="Xamarin.Forms" version="5.0.0.2012" />
<dependency id="Xamarin.Android.Support.CustomTabs" version="28.0.0.3" />
</dependencies>
</metadata>
</package>
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ namespace Okta.Xamarin.Android
[Activity(Label = "OktaCallbackInterceptorActivity", NoHistory = true, LaunchMode = LaunchMode.SingleInstance)]
public class OktaLoginCallbackInterceptorActivity<TMain> : Activity
{
protected override async void OnCreate(Bundle savedInstanceState)
protected override void OnCreate(Bundle savedInstanceState)
{
base.OnCreate(savedInstanceState);
global::Android.Net.Uri uri_android = Intent.Data;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ namespace Okta.Xamarin.Android
[Activity(Label = "OktaLogoutCallbackInterceptorActivity", NoHistory = true, LaunchMode = LaunchMode.SingleInstance)]
public class OktaLogoutCallbackInterceptorActivity<TMain> : Activity
{
protected override async void OnCreate(Bundle savedInstanceState)
protected override void OnCreate(Bundle savedInstanceState)
{
base.OnCreate(savedInstanceState);
global::Android.Net.Uri uri_android = Intent.Data;
Expand Down
Loading

0 comments on commit e4603e0

Please sign in to comment.